"

注册即送39 无需申请拥有全球最顶尖的原生APP,每天为您提供千场精彩体育赛事,注册即送39 无需申请更有真人、彩票、电子老虎机、真人电子竞技游戏等多种娱乐方式选择,注册即送39 无需申请让您尽享娱乐、赛事投注等,且无后顾之忧!

"
首頁 > eclipse開發首選項

eclipse開發首選項

互聯網 2021-04-14 20:57:36

我們現在來開發一個 右鍵點擊簡體中文的資源文件然后生成繁體中文的文件

由于資源文件中的漢字是unicode格式的 我們用jdk自帶的native2ascii來轉換回漢字文件

漢字文件轉換為繁體漢字文件后 最后又轉成繁體unicode文件同時添加到項目中

由于我們不知道native2ascii 的位置 所以我們可以使用首選項來配置一次native2ascii的位置

以后就使用這個位置 有些人會說 我們可以這樣獲得

String exePath=System.getProperty("java.home")+"/bin/native2ascii.exe";

但是你要考慮到eclipse自帶的jre中并沒有這個exe文件

?

當然采用這種方法還有另外一種解決辦法 就是將native2ascii.exe打包到jar包中然后拷貝的

jre的目錄中 者也是一種好辦法 這里先不討論 研究首選項先

?

首先簡體中文轉 繁體中文 我們可以用枚舉的方法解決,雖然有點惡心但是湊合著用

?

提供簡體中文和繁體中文互轉的方法

?

package lhplugin.utils;

public class SampleUtils {?public static String SimpleStr() {??return "啊阿埃挨哎唉哀皚癌藹矮艾礙愛隘鞍氨安俺按暗岸胺案骯昂盎凹敖熬翱襖傲奧懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙壩霸罷爸白柏百擺佰敗拜稗斑班搬扳般頒板版扮拌伴瓣半辦絆邦幫梆榜膀綁棒磅蚌鎊傍謗苞胞包褒剝薄雹保堡飽寶抱報暴豹鮑爆杯碑悲卑北輩背貝鋇倍狽備憊焙被奔苯本笨崩繃甭泵蹦迸逼鼻比鄙筆彼碧蓖蔽畢斃毖幣庇痹閉敝弊必辟壁臂避陛鞭邊編貶扁便變卞辨辯辮遍標彪膘表鱉憋別癟彬斌瀕濱賓擯兵冰柄丙秉餅炳病并玻菠播撥缽波博勃搏鉑箔伯帛舶脖膊渤泊駁捕卜哺補埠不布步簿部怖擦猜裁材才財睬踩采彩菜蔡餐參蠶殘慚慘燦蒼艙倉滄藏操糙槽曹草廁策側冊測層蹭插叉茬茶查碴搽察岔差詫拆柴豺攙摻蟬饞讒纏鏟產闡顫昌猖場嘗常長償腸廠敞暢唱倡超抄鈔朝嘲潮巢吵炒車扯撤掣徹澈郴臣辰塵晨忱沉陳趁襯撐稱城橙成呈乘程懲澄誠承逞騁秤吃癡持匙池遲弛馳恥齒侈尺赤翅斥熾充沖蟲崇寵抽酬疇躊稠愁籌仇綢瞅丑臭初出櫥廚躇鋤雛滁除楚礎儲矗搐觸處揣川穿椽傳船喘串瘡窗幢床闖創吹炊捶錘垂春椿醇唇淳純蠢戳綽疵茨磁雌辭慈瓷詞此刺賜次聰蔥囪匆從叢湊粗醋簇促躥篡竄摧崔催脆瘁粹淬翠村存寸磋撮搓措挫錯搭達答瘩打大呆歹傣戴帶殆代貸袋待逮怠耽擔丹單鄲撣膽旦氮但憚淡誕彈蛋當擋黨蕩檔刀搗蹈倒島禱導到稻悼道盜德得的蹬燈登等瞪凳鄧堤低滴迪敵笛狄滌翟嫡抵底地蒂第帝弟遞締顛掂滇碘點典靛墊電佃甸店惦奠淀殿碉叼雕凋刁掉吊釣調跌爹碟蝶迭諜疊丁盯叮釘頂鼎錠定訂丟東冬董懂動棟侗恫凍洞兜抖斗陡豆逗痘都督毒犢獨讀堵睹賭杜鍍肚度渡妒端短鍛段斷緞堆兌隊對墩噸蹲敦頓囤鈍盾遁掇哆多奪垛躲朵跺舵剁惰墮蛾峨鵝俄額訛娥惡厄扼遏鄂餓恩而兒耳爾餌洱二貳發罰筏伐乏閥法*藩帆番翻樊礬釩繁凡煩反返范販犯飯泛坊芳方肪房防妨仿訪紡放菲非啡飛肥匪誹吠肺廢沸費芬酚吩氛分紛墳焚汾粉奮份忿憤糞豐封楓蜂峰鋒風瘋烽逢馮縫諷奉鳳佛否夫敷膚孵扶拂輻幅氟符伏俘服浮涪福袱弗甫撫輔俯釜斧脯腑府腐赴副覆賦復傅付阜父腹負富訃附婦縛咐噶嘎該改概鈣蓋溉干甘桿柑竿肝趕感稈敢贛岡剛鋼缸肛綱崗港杠篙皋高膏羔糕搞鎬稿告哥歌擱戈鴿胳疙割革葛格蛤閣隔鉻個各給根跟耕更庚羹埂耿梗工攻功恭龔供躬公宮弓鞏汞拱貢共鉤勾溝茍狗垢構購夠辜菇咕箍估沽孤姑鼓古蠱骨谷股故顧固雇刮瓜剮寡掛褂乖拐怪棺關官冠觀管館罐慣灌貫光廣逛瑰規圭硅歸龜閨軌鬼詭癸桂柜跪貴劊輥滾棍鍋郭國果裹過哈骸孩海氦亥害駭酣憨邯韓含涵寒函喊罕翰撼捍旱憾悍焊汗漢夯杭航壕嚎豪毫郝好耗號浩呵喝荷菏核禾和何合盒貉閡河涸赫褐鶴賀嘿黑痕很狠恨哼亨橫衡恒轟哄烘虹鴻洪宏弘紅喉侯猴吼厚候后呼乎忽瑚壺葫胡蝴狐糊湖弧虎唬護互滬戶花嘩華猾滑畫劃化話槐徊懷淮壞歡環桓還緩換患喚瘓豢煥渙宦幻荒慌黃磺蝗簧皇凰惶煌晃幌恍謊灰揮輝徽恢蛔回毀悔慧卉惠晦賄穢會燴匯諱誨繪葷昏婚魂渾混豁活伙火獲或惑霍貨禍擊圾基機畸稽積箕肌饑跡激譏雞姬績緝吉極棘輯籍集及急疾汲即嫉級擠幾脊己薊技冀季伎祭劑悸濟寄寂計記既忌際繼紀嘉枷夾佳家加莢頰賈甲鉀假稼價架駕嫁殲監堅尖箋間煎兼肩艱奸緘繭檢柬堿鹼揀撿簡儉剪減薦檻鑒踐賤見鍵箭件健艦劍餞漸濺澗建僵姜將漿江疆蔣槳獎講匠醬降蕉椒礁焦膠交郊澆驕嬌嚼攪鉸矯僥腳狡角餃繳絞剿教酵轎較叫窖揭接皆秸街階截劫節莖睛晶鯨京驚精粳經井警景頸靜境敬鏡徑痙靖竟競凈炯窘揪究糾玖韭久灸九酒廄救舊臼舅咎就疚鞠拘狙疽居駒菊局咀矩舉沮聚拒據巨具距踞鋸俱句懼炬劇捐鵑娟倦眷卷絹撅攫抉掘倔爵桔杰捷睫竭潔結解姐戒藉芥界借介疥誡屆巾筋斤金今津襟緊錦僅謹進靳晉禁近燼浸盡勁荊兢覺決訣絕均菌鈞軍君峻俊竣??をE喀咖卡咯開揩楷凱慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤靠坷苛柯棵磕顆科殼咳可渴克刻客課肯啃墾懇坑吭空恐孔控摳口扣寇枯哭窟苦酷庫褲夸垮挎跨胯塊筷儈快寬款匡筐狂框礦眶曠況虧盔巋窺葵奎魁傀饋愧潰坤昆捆困括擴廓闊垃拉喇蠟臘辣啦萊來賴藍婪欄攔籃闌蘭瀾讕攬覽懶纜爛濫瑯榔狼廊郎朗浪撈勞牢老佬姥酪烙澇勒樂雷鐳蕾磊累儡壘擂肋類淚棱楞冷厘梨犁黎籬貍離漓理李里鯉禮莉荔吏栗麗厲勵礫歷利傈例俐痢立粒瀝隸力璃哩倆聯蓮連鐮廉憐漣簾斂臉鏈戀煉練糧涼梁粱良兩輛量晾亮諒撩聊僚療燎寥遼潦了撂鐐廖料列裂烈劣獵琳林磷霖臨鄰鱗淋凜賃吝拎玲菱零齡鈴伶羚凌靈陵嶺領另令溜琉榴硫餾留劉瘤流柳六龍聾嚨籠窿隆壟攏隴樓婁摟簍漏陋蘆盧顱廬爐擄鹵虜魯麓碌露路賂鹿潞祿錄陸戮驢呂鋁侶旅履屢縷慮氯律率濾綠巒攣孿灤卵亂掠略掄輪倫侖淪綸論蘿螺羅邏鑼籮騾裸落洛駱絡媽麻瑪碼螞馬罵嘛嗎埋買麥賣邁脈瞞饅蠻滿蔓曼慢漫謾芒茫盲氓忙莽貓茅錨毛矛鉚卯茂冒帽貌貿么玫枚梅酶霉煤沒眉媒鎂每美昧寐妹媚門悶們萌蒙檬盟錳猛夢孟瞇醚靡糜迷謎彌米秘覓泌蜜密冪棉眠綿冕免勉娩緬面苗描瞄藐秒渺廟妙蔑滅民抿皿敏憫閩明螟鳴銘名命謬摸摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌謀牟某拇牡畝姆母墓暮幕募慕木目睦牧穆拿哪吶鈉那娜納氖乃奶耐奈南男難囊撓腦惱鬧淖呢餒內嫩能妮霓倪泥尼擬你匿膩逆溺蔫拈年碾攆捻念娘釀鳥尿捏聶孽嚙鑷鎳涅您檸獰凝寧擰濘牛扭鈕紐膿濃農弄奴努怒女暖虐瘧挪懦糯諾哦歐鷗毆藕嘔偶漚啪趴爬帕怕琶拍排牌徘湃派攀潘盤磐盼畔判叛乓龐旁耪胖拋咆刨炮袍跑泡呸胚培裴賠陪配佩沛噴盆砰抨烹澎彭蓬棚硼篷膨朋鵬捧碰坯砒霹批披劈琵毗啤脾疲皮匹痞僻屁譬篇偏片騙飄漂瓢票撇瞥拼頻貧品聘乒坪蘋萍平憑瓶評屏坡潑頗婆破魄迫粕剖撲鋪仆莆葡菩蒲埔樸圃普浦譜曝瀑期欺棲戚妻七凄漆柒沏其棋奇歧畦崎臍齊旗祈祁騎起豈乞企啟契砌器氣迄棄汽泣訖掐洽牽扦釬鉛千遷簽仟謙乾黔錢鉗前潛遣淺譴塹嵌欠歉槍嗆腔羌墻薔強搶橇鍬敲悄橋瞧喬僑巧鞘撬翹峭俏竅切茄且怯竊欽侵親秦琴勤芹擒禽寢沁青輕氫傾卿清擎晴氰情頃請慶瓊窮秋丘邱球求囚酋泅趨區蛆曲軀屈驅渠取娶齲趣去圈顴權醛泉全痊拳犬券勸缺炔瘸卻鵲榷確雀裙群然燃冉染瓤壤攘嚷讓饒擾繞惹熱壬仁人忍韌任認刃妊紉扔仍日戎茸蓉榮融熔溶容絨冗揉柔肉茹蠕儒孺如辱乳汝入褥軟阮蕊瑞銳閏潤若弱撒灑薩腮鰓塞賽三叁傘散桑嗓喪搔騷掃嫂瑟色澀森僧莎砂殺剎沙紗*啥煞篩曬珊苫杉山刪煽衫閃陜擅贍膳善汕扇繕墑傷商賞晌上尚裳梢捎稍燒芍勺韶少哨邵紹奢賒蛇舌舍赦攝射懾涉社設砷申呻伸身深娠紳神沈審嬸甚腎慎滲聲生甥牲升繩省盛剩勝圣師失獅施濕詩尸虱十石拾時什食蝕實識史矢使屎駛始式示士世柿事拭誓逝勢是嗜噬適仕侍釋飾氏市恃室視試收手首守壽授售受瘦獸蔬樞梳殊抒輸叔舒淑疏書贖孰熟薯暑曙署蜀黍鼠屬術述樹束戍豎墅庶數漱恕刷耍摔衰甩帥栓拴霜雙爽誰水睡稅吮瞬順舜說碩朔爍斯撕嘶思私司絲死肆寺嗣四伺似飼巳松聳慫頌送宋訟誦搜艘擻嗽蘇酥俗素速粟僳塑溯宿訴肅酸蒜算雖隋隨綏髓碎歲穗遂隧祟孫損筍蓑梭唆縮瑣索鎖所塌他它她塔獺撻蹋踏胎苔抬臺泰酞太態汰坍攤貪癱灘壇檀痰潭譚談坦毯袒碳探嘆炭湯塘搪堂棠膛唐糖倘躺淌趟燙掏濤滔絳萄桃逃淘陶討套特藤騰疼謄梯剔踢銻提題蹄啼體替嚏惕涕剃屜天添填田甜恬舔腆挑條迢眺跳貼鐵帖廳聽烴汀廷停亭庭挺艇通桐酮瞳同銅彤童桶捅筒統痛偷投頭透凸禿突圖徒途涂屠土吐兔湍團推頹腿蛻褪退吞屯臀拖托脫鴕陀馱駝橢妥拓唾挖哇蛙洼娃瓦襪歪外豌彎灣玩頑丸烷完碗挽晚皖惋宛婉萬腕汪王亡枉網往旺望忘妄威巍微危韋違桅圍唯惟為濰維葦萎委偉偽尾緯未蔚味畏胃喂魏位渭謂尉慰衛瘟溫蚊文聞紋吻穩紊問嗡翁甕撾蝸渦窩我斡臥握沃巫嗚鎢烏污誣屋無蕪梧吾吳毋武五捂午舞伍侮塢戊霧晤物勿務悟誤昔熙析西硒矽晰嘻吸錫犧稀息希悉膝夕惜熄烯溪汐犀檄襲席習媳喜銑洗系隙戲細瞎蝦匣霞轄暇峽俠狹下廈夏嚇掀锨先仙鮮纖咸賢銜舷閑涎弦嫌顯險現獻縣腺餡羨憲陷限線相廂鑲香箱襄湘鄉翔祥詳想響享項巷橡像向象蕭硝霄削哮囂銷消宵淆曉小孝校肖嘯笑效楔些歇蝎鞋協挾攜邪斜脅諧寫械卸蟹懈泄瀉謝屑薪芯鋅欣辛新忻心信釁星腥猩惺興刑型形邢行醒幸杏性姓兄兇胸匈洶雄熊休修羞朽嗅銹秀袖繡墟戌需虛噓須徐許蓄酗敘旭序畜恤絮婿緒續軒喧宣懸旋玄選癬眩絢靴薛學*雪血勛熏循旬詢尋馴巡殉汛訓訊遜迅壓押鴉鴨呀丫芽牙蚜崖衙涯雅啞亞訝焉咽閹煙淹鹽嚴研蜒巖延言顏閻炎沿奄掩眼衍演艷堰燕厭硯雁唁彥焰宴諺驗殃央鴦秧楊揚佯瘍羊洋陽氧仰癢養樣漾邀腰妖瑤搖堯遙窯謠姚咬舀藥要耀椰噎耶爺野冶也頁掖業葉曳腋夜液一壹醫揖銥依伊衣頤夷遺移儀胰疑沂宜姨彝椅蟻倚已乙矣以藝抑易邑屹億役臆逸肄疫亦裔意毅憶義益溢詣議誼譯異翼翌繹茵蔭因殷音陰姻吟銀淫寅飲尹引隱印英櫻嬰鷹應纓瑩螢營熒蠅迎贏盈影穎硬映喲擁傭臃癰庸雍踴蛹詠泳涌永恿勇用幽優悠憂尤由郵鈾猶油游酉有友右佑釉誘又幼迂淤于盂榆虞愚輿余俞逾魚愉渝漁隅予娛雨與嶼禹宇語羽玉域芋郁吁遇喻峪御愈欲獄育譽浴寓裕預豫馭鴛淵冤元垣袁原援轅園員圓猿源緣遠苑愿怨院曰約越躍鑰岳粵月悅閱耘云鄖勻隕允運蘊醞暈韻孕匝砸雜栽哉災宰載再在咱攢暫贊贓臟葬遭糟鑿藻棗早澡蚤躁噪造皂灶燥責擇則澤賊怎增憎曾贈扎喳渣札軋鍘閘眨柵榨咋乍炸詐摘齋宅窄債寨瞻氈詹粘沾盞斬輾嶄展蘸棧占戰站湛綻樟章彰漳張掌漲杖丈帳賬仗脹瘴障招昭找沼趙照罩兆肇召遮折哲蟄轍者鍺蔗這浙珍斟真甄砧臻貞針偵枕疹診震振鎮陣蒸掙睜征猙爭怔整拯正政幀癥鄭證芝枝支吱蜘知肢脂汁之織職直植殖執值侄址指止趾只旨紙志摯擲至致置幟峙制智秩稚質炙痔滯治窒中盅忠鐘衷終種腫重仲眾舟周州洲謅粥軸肘帚咒皺宙晝驟珠株蛛朱豬諸誅逐竹燭煮拄矚囑主著柱助蛀貯鑄筑住注祝駐抓爪拽專磚轉撰賺篆樁莊裝妝撞壯狀椎錐追贅墜綴諄準捉拙卓桌琢茁酌啄著灼濁茲咨資姿滋淄孜紫仔籽滓子自漬字鬃棕蹤宗綜總縱鄒走奏揍租足卒族祖詛阻組鉆纂嘴醉最罪尊遵昨左佐柞做作坐座";?}

?// 繁體中文字?public static String TraStr() {??return "啊阿埃挨哎唉哀皚癌藹矮艾礙愛隘鞍氨安俺按暗岸胺案骯昂盎凹敖熬翺襖傲奧懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙壩霸罷爸白柏百擺佰敗拜稗斑班搬扳般頒板版扮拌伴瓣半辦絆邦幫梆榜膀綁棒磅蚌鎊傍謗苞胞包褒剝薄雹保堡飽寶抱報暴豹鮑爆杯碑悲卑北輩背貝鋇倍狽備憊焙被奔苯本笨崩繃甭泵蹦迸逼鼻比鄙筆彼碧蓖蔽畢斃毖幣庇痹閉敝弊必辟壁臂避陛鞭邊編貶扁便變卞辨辯辮遍標彪膘表鼈憋別癟彬斌瀕濱賓擯兵冰柄丙秉餅炳病並玻菠播撥缽波博勃搏鉑箔伯帛舶脖膊渤泊駁捕蔔哺補埠不布步簿部怖擦猜裁材才財睬踩采彩菜蔡餐參蠶殘慚慘燦蒼艙倉滄藏操糙槽曹草廁策側冊測層蹭插叉茬茶查碴搽察岔差詫拆柴豺攙摻蟬饞讒纏鏟産闡顫昌猖場嘗常長償腸廠敞暢唱倡超抄鈔朝嘲潮巢吵炒車扯撤掣徹澈郴臣辰塵晨忱沈陳趁襯撐稱城橙成呈乘程懲澄誠承逞騁秤吃癡持匙池遲弛馳恥齒侈尺赤翅斥熾充沖蟲崇寵抽酬疇躊稠愁籌仇綢瞅醜臭初出櫥廚躇鋤雛滁除楚礎儲矗搐觸處揣川穿椽傳船喘串瘡窗幢床闖創吹炊捶錘垂春椿醇唇淳純蠢戳綽疵茨磁雌辭慈瓷詞此刺賜次聰蔥囪匆從叢湊粗醋簇促躥篡竄摧崔催脆瘁粹淬翠村存寸磋撮搓措挫錯搭達答瘩打大呆歹傣戴帶殆代貸袋待逮怠耽擔丹單鄲撣膽旦氮但憚淡誕彈蛋當擋黨蕩檔刀搗蹈倒島禱導到稻悼道盜德得的蹬燈登等瞪凳鄧堤低滴迪敵笛狄滌翟嫡抵底地蒂第帝弟遞締顛掂滇碘點典靛墊電佃甸店惦奠澱殿碉叼雕凋刁掉吊釣調跌爹碟蝶疊諜疊丁盯叮釘頂鼎錠定訂丟東冬董懂動棟侗恫凍洞兜抖鬥陡豆逗痘都督毒犢獨讀堵睹賭杜鍍肚度渡妒端短鍛段斷緞堆兌隊對墩噸蹲敦頓囤鈍盾遁掇哆多奪垛躲朵跺舵剁惰墮蛾峨鵝俄額訛娥惡厄扼遏鄂餓恩而兒耳爾餌洱二貳發罰筏伐乏閥法琺藩帆番翻樊礬釩繁凡煩反返範販犯飯泛坊芳方肪房防妨仿訪紡放菲非啡飛肥匪誹吠肺廢沸費芬酚吩氛分紛墳焚汾粉奮份忿憤糞豐封楓蜂峰鋒風瘋烽逢馮縫諷奉鳳佛否夫敷膚孵扶拂輻幅氟符伏俘服浮涪福袱弗甫撫輔俯釜斧脯腑府腐赴副覆賦複傅付阜父腹負富訃附婦縛咐噶嘎該改概鈣蓋溉幹甘桿柑竿肝趕感稈敢贛岡剛鋼缸肛綱崗港杠篙臯高膏羔糕搞鎬稿告哥歌擱戈鴿胳疙割革葛格蛤閣隔鉻個各給根跟耕更庚羹埂耿梗工攻功恭龔供躬公宮弓鞏汞拱貢共鈎勾溝茍狗垢構購夠辜菇咕箍估沽孤姑鼓古蠱骨谷股故顧固雇刮瓜剮寡掛褂乖拐怪棺關官冠觀管館罐慣灌貫光廣逛瑰規圭矽歸龜閨軌鬼詭癸桂櫃跪貴劊輥滾棍鍋郭國果裹過哈骸孩海氦亥害駭酣憨邯韓含涵寒函喊罕翰撼捍旱憾悍焊汗漢夯杭航壕嚎豪毫郝好耗號浩呵喝荷菏核禾和何合盒貉閡河涸赫褐鶴賀嘿黑痕很狠恨哼亨橫衡恒轟哄烘虹鴻洪宏弘紅喉侯猴吼厚候後呼乎忽瑚壺葫胡蝴狐糊湖弧虎唬護互滬戶花嘩華猾滑畫劃化話槐徊懷淮壞歡環桓還緩換患喚瘓豢煥渙宦幻荒慌黃磺蝗簧皇凰惶煌晃幌恍謊灰揮輝徽恢蛔回毀悔慧卉惠晦賄穢會燴彙諱誨繪葷昏婚魂渾混豁活夥火獲或惑霍貨禍擊圾基機畸稽積箕肌饑跡激譏雞姬績緝吉極棘輯籍集及急疾汲即嫉級擠幾脊己薊技冀季伎祭劑悸濟寄寂計記既忌際繼紀嘉枷夾佳家加莢頰賈甲鉀假稼價架駕嫁殲監堅尖歸g煎兼肩艱奸糾O檢柬堿鹼揀撿簡儉剪減薦檻鑒踐賤見鍵箭件健艦劍餞漸濺澗建僵姜將漿江疆蔣槳獎講匠醬降蕉椒礁焦膠交郊澆驕嬌嚼攪鉸矯僥腳狡角餃繳絞剿教酵轎較叫窖揭接皆稭街階截劫節莖睛晶鯨京驚精粳經井警景頸靜境敬鏡徑痙靖竟競淨炯窘揪究糾玖韭久灸九酒廄救舊臼舅咎就疚鞠拘狙疽居駒菊局咀矩舉沮聚拒據巨具距踞鋸俱句懼炬劇捐鵑娟倦眷卷絹撅攫抉掘倔爵桔傑捷睫竭潔結解姐戒藉芥界借介疥誡屆巾筋斤金今津襟緊錦僅謹進靳晉禁近燼浸盡勁荊兢覺決訣絕均菌鈞軍君峻俊竣??をE喀咖卡咯開揩楷凱慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤靠坷苛柯棵磕顆科殼咳可渴克刻客課肯啃墾懇坑吭空恐孔控摳口扣寇枯哭窟苦酷庫褲誇垮挎跨胯塊筷儈快寬款匡筐狂框礦眶曠況虧盔巋窺葵奎魁傀饋愧潰坤昆捆困括擴廓闊垃拉喇蠟臘辣啦萊來賴藍婪欄攔籃闌蘭瀾讕攬覽懶纜爛濫瑯榔狼廊郎朗浪撈勞牢老佬姥酪烙澇勒樂雷鐳蕾磊累儡壘擂肋類淚棱楞冷厘梨犁黎籬貍離漓理李裏鯉禮莉荔吏栗麗厲勵礫曆利傈例俐痢立粒瀝隸力璃哩倆聯蓮連鐮廉憐漣簾斂臉鏈戀煉練糧涼梁粱良兩輛量晾亮諒撩聊僚療燎寥遼潦了撂鐐廖料列裂烈劣獵琳林磷霖臨鄰鱗淋凜賃吝拎玲菱零齡鈴伶羚淩靈陵嶺領另令溜琉榴硫餾留劉瘤流柳六龍聾嚨籠窿隆壟攏隴樓婁摟簍漏陋蘆盧顱廬爐擄鹵虜魯麓碌露路賂鹿潞祿錄陸戮驢呂鋁侶旅履屢縷慮氯律率濾綠巒攣孿灤卵亂掠略掄輪倫侖淪綸論蘿螺羅邏鑼籮騾裸落洛駱絡媽麻瑪碼螞馬罵嘛嗎埋買麥賣邁脈瞞饅蠻滿蔓曼慢漫謾芒茫盲氓忙莽貓茅錨毛矛鉚卯茂冒帽貌貿麼玫枚梅酶黴煤沒眉媒鎂每美昧寐妹媚門悶們萌蒙檬盟錳猛夢孟瞇醚靡糜迷謎彌米秘覓泌蜜密冪棉眠綿冕免勉娩緬面苗描瞄藐秒渺廟妙蔑滅民抿皿敏憫閩明螟鳴銘名命謬摸摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌謀牟某拇牡畝姆母墓暮幕募慕木目睦牧穆拿哪吶鈉那娜納氖乃奶耐奈南男難囊撓腦惱鬧淖呢餒內嫩能妮霓倪泥尼擬你匿膩逆溺蔫拈年碾攆撚念娘釀鳥尿捏聶孽齧鑷鎳涅您檸獰凝甯擰濘牛扭鈕紐膿濃農弄奴努怒女暖虐瘧挪懦糯諾哦歐鷗毆藕嘔偶漚啪趴爬帕怕琶拍排牌徘湃派攀潘盤磐盼畔判叛乓龐旁耪胖拋咆刨炮袍跑泡呸胚培裴賠陪配佩沛噴盆砰抨烹澎彭蓬棚硼篷膨朋鵬捧碰坯砒霹批披劈琵毗啤脾疲皮匹痞僻屁譬篇偏片騙飄漂瓢票撇瞥拼頻貧品聘乒坪蘋萍平憑瓶評屏坡潑頗婆破魄迫粕剖撲鋪仆莆葡菩蒲埔樸圃普浦譜曝瀑期欺棲戚妻七淒漆柒沏其棋奇歧畦崎臍齊旗祈祁騎起豈乞企啓契砌器氣迄棄汽泣訖掐洽牽扡釺鉛千遷簽仟謙乾黔錢鉗前潛遣淺譴塹嵌欠歉槍嗆腔羌牆薔強搶橇鍬敲悄橋瞧喬僑巧鞘撬翹峭俏竅切茄且怯竊欽侵親秦琴勤芹擒禽寢沁青輕氫傾卿清擎晴氰情頃請慶瓊窮秋丘邱球求囚酋泅趨區蛆曲軀屈驅渠取娶齲趣去圈顴權醛泉全痊拳犬券勸缺炔瘸卻鵲榷確雀裙群然燃冉染瓤壤攘嚷讓饒擾繞惹熱壬仁人忍韌任認刃妊紉扔仍日戎茸蓉榮融熔溶容絨冗揉柔肉茹蠕儒孺如辱乳汝入褥軟阮蕊瑞銳閏潤若弱撒灑薩腮鰓塞賽三三傘散桑嗓喪搔騷掃嫂瑟色澀森僧莎砂殺剎沙紗*啥煞篩曬珊苫杉山刪煽衫閃陝擅贍膳善汕扇繕墑傷商賞晌上尚裳梢捎稍燒芍勺韶少哨邵紹奢賒蛇舌舍赦攝射懾涉社設砷申呻伸身深娠紳神沈審嬸甚腎慎滲聲生甥牲升繩省盛剩勝聖師失獅施濕詩屍虱十石拾時什食蝕實識史矢使屎駛始式示士世柿事拭誓逝勢是嗜噬適仕侍釋飾氏市恃室視試收手首守壽授售受瘦獸蔬樞梳殊抒輸叔舒淑疏書贖孰熟薯暑曙署蜀黍鼠屬術述樹束戍豎墅庶數漱恕刷耍摔衰甩帥栓拴霜雙爽誰水睡稅吮瞬順舜說碩朔爍斯撕嘶思私司絲死肆寺嗣四伺似飼巳松聳慫頌送宋訟誦搜艘擻嗽蘇酥俗素速粟僳塑溯宿訴肅酸蒜算雖隋隨綏髓碎歲穗遂隧祟孫損筍蓑梭唆縮瑣索鎖所塌他它她塔獺撻蹋踏胎苔擡臺泰酞太態汰坍攤貪癱灘壇檀痰潭譚談坦毯袒碳探歎炭湯塘搪堂棠膛唐糖倘躺淌趟燙掏濤滔縧萄桃逃淘陶討套特藤騰疼謄梯剔踢銻提題蹄啼體替嚏惕涕剃屜天添填田甜恬舔腆挑條迢眺跳貼鐵帖廳聽烴汀廷停亭庭挺艇通桐酮瞳同銅彤童桶捅筒統痛偷投頭透凸禿突圖徒途塗屠土吐兔湍團推頹腿蛻褪退吞屯臀拖托脫鴕陀馱駝橢妥拓唾挖哇蛙窪娃瓦襪歪外豌彎灣玩頑丸烷完碗挽晚皖惋宛婉萬腕汪王亡枉網往旺望忘妄威巍微危韋違桅圍唯惟爲濰維葦萎委偉僞尾緯未蔚味畏胃喂魏位渭謂尉慰衛瘟溫蚊文聞紋吻穩紊問嗡翁甕撾蝸渦窩我斡臥握沃巫嗚鎢烏汙誣屋無蕪梧吾吳毋武五捂午舞伍侮塢戊霧晤物勿務悟誤昔熙析西硒矽晰嘻吸錫犧稀息希悉膝夕惜熄烯溪汐犀檄襲席習媳喜銑洗系隙戲細瞎蝦匣霞轄暇峽俠狹下廈夏嚇掀鍁先仙鮮纖鹹賢銜舷閑涎弦嫌顯險現獻縣腺餡羨憲陷限線相廂鑲香箱襄湘鄉翔祥詳想響享項巷橡像向象蕭硝霄削哮囂銷消宵淆曉小孝校肖嘯笑效楔些歇蠍鞋協挾攜邪斜脅諧寫械卸蟹懈泄瀉謝屑薪芯鋅欣辛新忻心信釁星腥猩惺興刑型形邢行醒幸杏性姓兄兇胸匈洶雄熊休修羞朽嗅鏽秀袖繡墟戌需虛噓須徐許蓄酗敘旭序畜恤絮婿緒續軒喧宣懸旋玄選癬眩絢靴薛學*雪血勳熏循旬詢尋馴巡殉汛訓訊遜迅壓押鴉鴨呀丫芽牙蚜崖衙涯雅啞亞訝焉咽閹煙淹鹽嚴研蜒巖延言顔閻炎沿奄掩眼衍演豔堰燕厭硯雁唁彥焰宴諺驗殃央鴦秧楊揚佯瘍羊洋陽氧仰癢養樣漾邀腰妖瑤搖堯遙窯謠姚咬舀藥要耀椰噎耶爺野冶也頁掖業葉曳腋夜液一壹醫揖銥依伊衣頤夷遺移儀胰疑沂宜姨彜椅蟻倚已乙矣以藝抑易邑屹億役臆逸肄疫亦裔意毅憶義益溢詣議誼譯異翼翌繹茵蔭因殷音陰姻吟銀淫寅飲尹引隱印英櫻嬰鷹應纓瑩螢營熒蠅迎贏盈影穎硬映喲擁傭臃癰庸雍踴蛹詠泳湧永恿勇用幽優悠憂尤由郵鈾猶油遊酉有友右佑釉誘又幼迂淤于盂榆虞愚輿余俞逾魚愉渝漁隅予娛雨與嶼禹宇語羽玉域芋郁籲遇喻峪禦愈欲獄育譽浴寓裕預豫馭鴛淵冤元垣袁原援轅園員圓猿源緣遠苑願怨院曰約越躍鑰嶽粵月悅閱耘雲鄖勻隕允運蘊醞暈韻孕匝砸雜栽哉災宰載再在咱攢暫贊贓髒葬遭糟鑿藻棗早澡蚤躁噪造皂竈燥責擇則澤賊怎增憎曾贈紮喳渣劄軋鍘閘眨柵榨咋乍炸詐摘齋宅窄債寨瞻氈詹粘沾盞斬輾嶄展蘸棧占戰站湛綻樟章彰漳張掌漲杖丈帳賬仗脹瘴障招昭找沼趙照罩兆肇召遮折哲蟄轍者鍺蔗這浙珍斟真甄砧臻貞針偵枕疹診震振鎮陣蒸掙睜征猙爭怔整拯正政幀癥鄭證芝枝支吱蜘知肢脂汁之織職直植殖執值侄址指止趾只旨紙志摯擲至致置幟峙制智秩稚質炙痔滯治窒中盅忠鍾衷終種腫重仲衆舟周州洲謅粥軸肘帚咒皺宙晝驟珠株蛛朱豬諸誅逐竹燭煮拄矚囑主著柱助蛀貯鑄築住注祝駐抓爪拽專磚轉撰賺篆樁莊裝妝撞壯狀椎錐追贅墜綴諄準捉拙卓桌琢茁酌啄著灼濁茲咨資姿滋淄孜紫仔籽滓子自漬字鬃棕蹤宗綜總縱鄒走奏揍租足卒族祖詛阻組鑽纂嘴醉最罪尊遵昨左佐柞做作坐座";?}?// 簡體中文轉繁體中文?public static String TraToSimple(String text) {??String str = "";??for (int i = 0; i < text.length(); i++) {???char tempchar = text.charAt(i);???if (TraStr().indexOf(tempchar) >= 0) {????str = str + SimpleStr().charAt(TraStr().indexOf(tempchar));???} else????str = str + tempchar;??}??return str;?}

?// 繁體中文轉簡體中文?public static String SimpleToTra(String text) {??String str = "";??for (int i = 0; i < text.length(); i++) {???char tempchar = text.charAt(i);???if (SimpleStr().indexOf(tempchar) >= 0) {????str = str + TraStr().charAt(SimpleStr().indexOf(tempchar));???} else????str = str + tempchar;??}??return str;?}}

?

添加文件向導 拓展

?

????? ????? ????? ?????

?

添加控制類

?

package lhplugin.wizards;

import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.ByteArrayInputStream;import java.io.File;import java.io.FileReader;import java.io.FileWriter;import java.io.IOException;import java.io.InputStream;import java.lang.reflect.InvocationTargetException;

import lhplugin.utils.SampleUtils;

import org.eclipse.core.resources.IContainer;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.IProgressMonitor;import org.eclipse.core.runtime.IStatus;import org.eclipse.core.runtime.Path;import org.eclipse.core.runtime.Status;import org.eclipse.jface.dialogs.MessageDialog;import org.eclipse.jface.operation.IRunnableWithProgress;import org.eclipse.jface.viewers.ISelection;import org.eclipse.jface.viewers.IStructuredSelection;import org.eclipse.jface.wizard.Wizard;import org.eclipse.ui.INewWizard;import org.eclipse.ui.IWorkbench;import org.eclipse.ui.IWorkbenchPage;import org.eclipse.ui.IWorkbenchWizard;import org.eclipse.ui.PartInitException;import org.eclipse.ui.PlatformUI;import org.eclipse.ui.ide.IDE;

/**?* This is a sample new wizard. Its role is to create a new file resource in the?* provided container. If the container resource (a folder or a project) is?* selected in the workspace when the wizard is opened, it will accept it as the?* target container. The wizard creates one file with the extension "mpe". If a?* sample multi-page editor (also available as a template) is registered for the?* same extension, it will be able to open it.?*/

public class SampleNewWizard extends Wizard implements INewWizard {?private SampleNewWizardPage page;?private ISelection selection;

?/**? * Constructor for SampleNewWizard.? */?public SampleNewWizard() {??super();??setNeedsProgressMonitor(true);?}

?/**? * Adding the page to the wizard.? */

?public void addPages() {??page = new SampleNewWizardPage(selection);??this.setWindowTitle("簡體繁體互相轉換 作者:小瓊瓊");??addPage(page);?}

?/**? * This method is called when 'Finish' button is pressed in the wizard. We? * will create an operation and run it using wizard as execution context.? */?public boolean performFinish() {??final String fileName = page.getFilePath();??final String binName = page.text.getText(); // page.getFileName();??final boolean isTts = page.tts.getSelection();??final IFile ifile=page.ifile;??IRunnableWithProgress op = new IRunnableWithProgress() {???public void run(IProgressMonitor monitor)?????throws InvocationTargetException {????try {?????int type = 0;?????if (isTts)??????type = 1;?????else??????type = 0;?????doFinish(monitor, fileName, binName, type,ifile);????} catch (Exception e) {?????throw new InvocationTargetException(e);????} finally {?????monitor.done();????}???}??};??try {???getContainer().run(true, false, op);??} catch (InterruptedException e) {???return false;??} catch (InvocationTargetException e) {???Throwable realException = e.getTargetException();???MessageDialog.openError(getShell(), "Error", realException?????.getMessage());???return false;??}??return true;?}

?private void doFinish(IProgressMonitor monitor, String fileName,???String binPath, int type,IFile ifile) {??monitor.beginTask("開始創建繁體文件", 3);??File pFile = new File(fileName);??String dir = pFile.getParentFile().getAbsolutePath();??String fileNameExcept = pFile.getName().substring(0,????pFile.getName().indexOf("."));??int index = 0;??if (type == 0 && (index = fileNameExcept.indexOf("_zh_CN")) >= 0) {???fileNameExcept = fileNameExcept.substring(0, index);??}??if (type == 1 && (index = fileNameExcept.indexOf("_zh_TW")) >= 0) {???fileNameExcept = fileNameExcept.substring(0, index);??}??String tempFile = System.getProperty("java.io.tmpdir")????+ "temp.properties";??String tempFile1 = System.getProperty("java.io.tmpdir")????+ "temp1.properties";

??String dstFile = null;??if (type == 0)???dstFile = dir + "/" + fileNameExcept + "_zh_TW.properties";??else???dstFile = dir + "/" + fileNameExcept + "_zh_CN.properties";??File mFile = new File(dstFile);??try {???mFile.createNewFile();???if (type == 0) {????monitor.setTaskName("開始簡體unicode轉換簡體原文");???} else {????monitor.setTaskName("開始繁體unicode轉換繁體原文");???}???monitor.worked(1);???Process p1 = Runtime.getRuntime().exec(?????binPath + " -reverse " + fileName + " " + tempFile);???p1.waitFor();??????File tpFile = new File(tempFile1);???if (tpFile.exists())????tpFile.delete();???tpFile.createNewFile();???BufferedWriter writer = new BufferedWriter(?????new FileWriter(tempFile1));???BufferedReader read = new BufferedReader(new FileReader(tempFile));???String line = null;???while ((line = read.readLine()) != null) {????if (type == 0)?????line = SampleUtils.SimpleToTra(line);????else?????line = SampleUtils.TraToSimple(line);????writer.write(line);????writer.newLine();???}???read.close();???writer.close();???if (type == 0)????monitor.setTaskName("開始繁體轉換unicode");???else????monitor.setTaskName("開始簡體轉換unicode");???monitor.worked(1);

???Process p = Runtime.getRuntime().exec(?????binPath + " " + tempFile1 + " " + dstFile);???p.waitFor();???monitor.worked(1);???tpFile.delete();???new File(tempFile).delete();???//第一個參數是 monitor走的步驟 意思當前文件的上一級強制刷新???ifile.getParent().refreshLocal(1,monitor);??} catch (Exception e) {???// TODO Auto-generated catch block???e.printStackTrace();??}

?}

?private void doFinish(String containerName, String fileName,???IProgressMonitor monitor) throws CoreException {??// create a sample file??monitor.beginTask("Creating " + fileName, 2);??IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();??IResource resource = root.findMember(new Path(containerName));??if (!resource.exists() || !(resource instanceof IContainer)) {???throwCoreException("Container /"" + containerName?????+ "/" does not exist.");??}??IContainer container = (IContainer) resource;??final IFile file = container.getFile(new Path(fileName));??try {???InputStream stream = openContentStream();???if (file.exists()) {????file.setContents(stream, true, true, monitor);???} else {????file.create(stream, true, monitor);???}???stream.close();??} catch (IOException e) {??}??monitor.worked(1);??monitor.setTaskName("Opening file for editing...");??getShell().getDisplay().asyncExec(new Runnable() {???public void run() {????IWorkbenchPage page = PlatformUI.getWorkbench()??????.getActiveWorkbenchWindow().getActivePage();????try {?????IDE.openEditor(page, file, true);????} catch (PartInitException e) {????}???}??});??monitor.worked(1);?}

?/**? * We will initialize file contents with a sample text.? */

?private InputStream openContentStream() {??String contents = "This is the initial file contents for *.mpe file that should be word-sorted in the Preview page of the multi-page editor";??return new ByteArrayInputStream(contents.getBytes());?}

?private void throwCoreException(String message) throws CoreException {??IStatus status = new Status(IStatus.ERROR, "lhplugin", IStatus.OK,????message, null);??throw new CoreException(status);?}

?/**? * We will accept the selection in the workbench to see if we can initialize? * from it.? * ? * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)? */?public void init(IWorkbench workbench, IStructuredSelection selection) {??this.selection = selection;?}}

?

?

添加向導頁

?

package lhplugin.wizards;

import javax.swing.JFileChooser;

import lhplugin.Activator;import lhplugin.utils.SampleUtils;

import org.eclipse.core.resources.IFile;import org.eclipse.core.resources.IResource;import org.eclipse.jface.dialogs.IDialogPage;import org.eclipse.jface.viewers.ISelection;import org.eclipse.jface.viewers.IStructuredSelection;import org.eclipse.jface.wizard.WizardPage;import org.eclipse.swt.SWT;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.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;import org.eclipse.swt.widgets.Label;import org.eclipse.swt.widgets.Text;

/**?* The "New" wizard page allows setting the container for the new file as well?* as the file name. The page will only accept file name without the extension?* OR with the extension that matches the expected one (mpe).?*/

public class SampleNewWizardPage extends WizardPage {?private Text containerText;

?public Text text;

?private Text ptext;

?private ISelection selection;

?private String filePath;

?public Button stt;

?public Button tts;

?public String getFilePath() {??return filePath;?}

?public void setFilePath(String filePath) {??this.filePath = filePath;?}

?/**? * Constructor for SampleNewWizardPage.? * ? * @param pageName? */?public SampleNewWizardPage(ISelection selection) {??super("簡體轉繁體向導頁面");??setTitle("簡體轉繁體");??setDescription("LH產品提供商提供此工具,此插件那是相當的nb");??this.selection = selection;?}

?public void addSpaceGraid(Composite container, int length) {??for (int i = 0; i < length; i++) {???Label temp = new Label(container, SWT.NULL);??}?}

?/**? * @see IDialogPage#createControl(Composite)? */?public void createControl(Composite parent) {??Composite container = new Composite(parent, SWT.NULL);??GridLayout layout = new GridLayout();??container.setLayout(layout);??layout.numColumns = 3;??layout.verticalSpacing = 9;??// 第一行 選擇 簡繁體互相轉換??Label tlable = new Label(container, SWT.NULL);??tlable.setText("轉換類型");??stt = new Button(container, SWT.RADIO | SWT.LEFT);??stt.setText("簡體轉繁體");??stt.setSelection(true);??GridData sttda = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);??stt.setLayoutData(sttda);??GridData da = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);??da.horizontalSpan = 1;??tts = new Button(container, SWT.RADIO | SWT.LEFT);??tts.setText("繁體轉簡體");??tts.setLayoutData(da);

??Label plable = new Label(container, SWT.NULL);??plable.setText("資源文件");

??ptext = new Text(container, SWT.BORDER | SWT.SINGLE);??GridData data1 = new GridData(GridData.FILL_HORIZONTAL);??ptext.setLayoutData(data1);??addSpaceGraid(container, 1);??Label lable = new Label(container, SWT.NULL);??lable.setText("請選擇native2ascii位置");

??text = new Text(container, SWT.BORDER | SWT.SINGLE);??GridData data = new GridData(GridData.FILL_HORIZONTAL);??// Activator.getDefault().getDialogSettings() 在eclipse為關閉之前 一直存在的鍵值對??// 可以用來??// Activator.getDefault().getPreferenceStore()也可以實現以上功能不過 這個是用于記錄首選項的鍵值對??// 記錄一些數據??String initValue = null;??//首先去獲取首選項中的值??initValue = Activator.getDefault().getPreferenceStore().getString(????"globelExePath");??//首選項中沒有再去這里去??if (initValue == null)???initValue = Activator.getDefault().getDialogSettings().get(?????"exePath");??if (initValue != null) {???text.setText(initValue);??} else???text?????.setText("C://Program Files//Java//jdk1.5.0_06//bin//native2ascii.exe");??text.setLayoutData(data);

??text.addModifyListener(new ModifyListener() {

???public void modifyText(ModifyEvent arg0) {????// TODO Auto-generated method stub????dialogChanged();???}??});??Button warn = new Button(container, SWT.PUSH);??warn.setText("選擇文件");??final FileDialog diag = new FileDialog(container.getShell(), SWT.OPEN);??warn.addSelectionListener(new SelectionAdapter() {???@Override???public void widgetSelected(SelectionEvent ev) {????diag.setFilterExtensions(new String[] { "*.exe" });????text.setText(diag.open());????Activator.getDefault().getDialogSettings().put("exePath",??????text.getText());????// JFileChooser file = new JFileChooser();????// if (file.showOpenDialog(null) == JFileChooser.FILES_ONLY) {????// text.setText(file.getSelectedFile().getAbsolutePath());????// }???}??});

??addSpaceGraid(container, 2);??Button zh1 = new Button(container, SWT.PUSH | SWT.LEFT_TO_RIGHT);??zh1.setText("清空");??zh1.addSelectionListener(new SelectionAdapter() {???public void widgetSelected(SelectionEvent ev) {????text.setText("");????ptext.setText("");???}??});??addSpaceGraid(container, 3);??Label tlable1 = new Label(container, SWT.NULL);??tlable1.setText("簡體中文字符");??text11 = new Text(container, SWT.BORDER | SWT.SINGLE);??GridData data11 = new GridData(GridData.FILL_HORIZONTAL);??text11.setLayoutData(data11);??text11.addFocusListener(new FocusListener() {

???public void focusGained(FocusEvent arg0) {????// TODO Auto-generated method stub

???}

???public void focusLost(FocusEvent arg0) {????// TODO Auto-generated method stub????text22.setText(SampleUtils.SimpleToTra(text11.getText()));???}

??});

??addSpaceGraid(container, 1);??Label tlable2 = new Label(container, SWT.NULL);??tlable2.setText("繁體中文字符");??text22 = new Text(container, SWT.BORDER | SWT.SINGLE);??GridData data22 = new GridData(GridData.FILL_HORIZONTAL);??text22.setLayoutData(data22);??text22.addFocusListener(new FocusListener() {

???public void focusGained(FocusEvent arg0) {????// TODO Auto-generated method stub

???}

???public void focusLost(FocusEvent arg0) {????// TODO Auto-generated method stub????text11.setText(SampleUtils.TraToSimple(text22.getText()));???}

??});??addSpaceGraid(container, 1);??addSpaceGraid(container, 2);??Button zh = new Button(container, SWT.PUSH | SWT.LEFT_TO_RIGHT);??zh.setText("轉換");??zh.addSelectionListener(new SelectionAdapter() {???public void widgetSelected(SelectionEvent ev) {????if (text11.getText().length() > text22.getText().length()) {?????text22.setText(SampleUtils.SimpleToTra(text11.getText()));????} else {?????text11.setText(SampleUtils.TraToSimple(text22.getText()));????}???}??});??initialize();??// dialogChanged();??setControl(container);?}

?boolean isCha = false;?Text text11;?Text text22;?public IFile ifile;?private void initialize() {??if (selection != null && selection.isEmpty() == false????&& selection instanceof IStructuredSelection) {???IStructuredSelection ssel = (IStructuredSelection) selection;???if (ssel.size() > 1)????return;???Object obj = ssel.getFirstElement();???if (obj instanceof IResource) {????IFile container = null;????if (obj instanceof IFile) {?????container = (IFile) obj;?????filePath = container.getLocationURI().getPath();?????ptext.setText(container.getName());?????if (filePath.indexOf(".properties") < 0) {??????updateStatus("請選擇資源文件");?????} else {??????updateStatus(null);??????ifile=(IFile)obj;?????}????} else {?????updateStatus("請選擇資源文件");????}????// containerText.setText(container.getFullPath().toString());???}??}

?}

?/**? * Ensures that both text fields are set.? */

?private void dialogChanged() {??if (text.getText().indexOf("native2ascii.exe") < 0)???updateStatus("native2ascii.exe文件");??else???updateStatus(null);?}

?private void updateStatus(String message) {??setErrorMessage(message);??setPageComplete(message == null);?}

?public String getContainerName() {??return containerText.getText();?}

}

?

當然是先到這里已經可以使用了因為我提供了一個文本框供 用戶自己選擇一個native2ascii 我們不可能

人家用的時候每次都選擇一個

?

initValue = Activator.getDefault().getDialogSettings().get(?????"exePath");

?

這個getDialogSettings 生命周期是eclipse開著的時候 下次開eclipse時候 里面的只會被清空掉

所以上面的代碼可以解決一次開著eclipse native2ascii 值一直在的情況

?

每次開eclipse都需要重新設置 好麻煩啊? 所以我們用首選項

?

首選項的值 存在 initValue = Activator.getDefault().getPreferenceStore().getString(????"globelExePath");

他會一直存著直到插件被卸載掉

?

?

?

添加首選項的拓展

?

?

??? ????? ????? ??

?? ????? ????? ??

?

?? 第二個拓展表示初始化的時候要設置哪些變量到 Activator.getDefault().getPreferenceStore()中

? 首選項里面的的值都是對應到 Activator.getDefault().getPreferenceStore()的鍵值對

?

添加類

?

package lhplugin.preference;

import java.awt.TextField;

import lhplugin.Activator;

import org.eclipse.jface.dialogs.MessageDialog;import org.eclipse.jface.preference.FieldEditorPreferencePage;import org.eclipse.jface.preference.FileFieldEditor;import org.eclipse.jface.preference.StringFieldEditor;import org.eclipse.ui.IWorkbench;import org.eclipse.ui.IWorkbenchPreferencePage;

public class LhPreferencePage extends FieldEditorPreferencePage implements??IWorkbenchPreferencePage {?public LhPreferencePage(){??super(LhPreferencePage.GRID);??setDescription("設置全局jdk資源文件編輯環境");??setPreferenceStore(Activator.getDefault().getPreferenceStore());?}?@Override?protected void createFieldEditors() {??// TODO Auto-generated method stub??FileFieldEditor file=new FileFieldEditor("globelExePath","請選擇native2ascii位置",getFieldEditorParent());??file.setFileExtensions(new String[]{"*.exe"});??addField(file);?}?//點擊ok的時候 當然還有其他一下方法 比如取消你可以自己去實現?//點擊ok后 store中的值就會自動被改成改后的值?public boolean performOk() {??// TODO Auto-generated method stub??return super.performOk();?}?public void init(IWorkbench arg0) {??// TODO Auto-generated method stub???}

}

首選項所有的空間都是鍵值對存值的所以他有自己的一套控件

?

下面是控件列表:

?

l BooleanFieldEditor——布爾字段編輯器。l IntegerFieldEditor——整數編輯器,可調用setValidRange來限制整數的范圍。l StringFieldEditor——文本編輯器,可以調用setEmptyStringAllowed來限制是否能為空。l RadioGroupFieldEditor——單選按鈕組編輯器。l ColorFieldEditor——顏色編輯器。l FontFieldEditor——字體編輯器。l DirectoryFieldEditor——文件夾編輯器。l FileFieldEditor——文件編輯器。l ScaleFieldEditor——步進范圍整數編輯器。

?

//初始化類

?

package lhplugin.preference;

import lhplugin.Activator;

import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;import org.eclipse.jface.preference.IPreferenceStore;

public class PreferenceInitializer extends AbstractPreferenceInitializer {

?@Override?public void initializeDefaultPreferences() {??// TODO Auto-generated method stub??IPreferenceStore store=Activator.getDefault().getPreferenceStore();??store.setDefault("globelExePath", "");?}

}

免責聲明:非本網注明原創的信息,皆為程序自動獲取互聯網,目的在于傳遞更多信息,并不代表本網贊同其觀點和對其真實性負責;如此頁面有侵犯到您的權益,請給站長發送郵件,并提供相關證明(版權證明、身份證正反面、侵權鏈接),站長將在收到郵件12小時內刪除。
注册即送39 无需申请 <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <文本链> <文本链> <文本链> <文本链> <文本链> <文本链>