// 下階層用テンプレート #topicpath ---- //ここにコンテンツを記述します。 #contents **オンラインアップデート [#w606b6f8] Eclipseはサーバに置いたプラグインをダウンロードし、アップデートことができますが、ダウンロードできるプラグインはサーバにあるsite.xmlの内容で制御されています。たとえば、こんな感じです。 -site.xmlのサンプル <?xml version="1.0" encoding="UTF-8"?> <site> <feature url="features/nu.mine.kino.plugin.google_1.0.6.jar" id="nu.mine.kino.plugin.google" version="1.0.6"> <category name="google"/> </feature> <feature url="features/nu.mine.kino.plugin.google_1.0.7.jar" id="nu.mine.kino.plugin.google" version="1.0.7"> <category name="google"/> </feature> <feature url="features/nu.mine.kino.plugin.google_1.0.9.jar" id="nu.mine.kino.plugin.google" version="1.0.9"> <category name="google"/> </feature> <category-def name="google" label="Google Plugin"/> </site> **ダウンロードできるプラグインの制御 [#fcf4b9f3] さて、RCPで普通のアプリを作る場合、あるユーザはhogehogeプラグインのみ使用可能、で特定のユーザはさらにfugaプラグインも使用可能にする、なんてことをやりたいですね。しかしsite.xmlは通常静的なファイルであること、さらにsite.xmlをServletなどで動的に生成し、パラメータによってsite.xmlの内容を切り替えるなんてことをやったとしても、アップデートサイトへのリクエスト(HTTP)にパラメタを載せる方法がわかりませんでした。 まあサーバ側はIPアドレスとかで判断することもできなくないですが、あんまりエレガントではないですね。 **そこでこんな感じ [#pcb1af9d] そこでEclipseの更新UIではなくて、自分でアクションを作成し、アップデートサイトにアクセスするコードを作ってみました。 BusyIndicator.showWhile(window.getShell().getDisplay(), new Runnable() { public void run() { logger.debug("run() - start"); // UpdateManagerUI.openInstaller(window.getShell()); UpdateJob job = new UpdateJob("Search for new extensions.", getSearchRequest()); UpdateManagerUI.openInstaller(window.getShell(), job); logger.debug("run() - end"); } }); private UpdateSearchRequest getSearchRequest() { URL url = null; try { url = new URL("http://hogehoge.com/site.xml");// <-site.xmlのURL } catch (MalformedURLException e) { e.printStackTrace(); } UpdateSearchRequest result = new UpdateSearchRequest( UpdateSearchRequest.createDefaultSiteSearchCategory(), new UpdateSearchScope()); result.addFilter(new BackLevelFilter()); <-よくわからん result.addFilter(new EnvironmentFilter()); <-よくわからん UpdateSearchScope scope = new UpdateSearchScope(); scope.addSearchSite("HogeApp Site", url, null); // scope.addSearchSite("aaa", url, null); 複数追加すると複数サーチする result.setScope(scope); return result; } これえURLを指定できるので、このパラメタにユーザIDみたいな情報を載っければいいわけですね。でも、 -アップデートサイトのURLがプログラムに書かれてしまって、すでにインストールされているフィーチャーのサイトを見てくれるのかわかんない。 -自動更新とかを有効にしても、上のURLのチェックはしてくれないだろう などなどの問題が残りますね。。。 ---- この記事は #vote(おもしろかった[2],そうでもない[0]) #vote(おもしろかった[3],そうでもない[0]) -あいかわらず、じかんねー -- [[きの]] &new{2006-08-24 01:32:11 (木)}; - 貴重な情報、ありがとうございます。現行の3.3の場合、更新ダイアログが英語なんですよね。何とか日本語化するか、自動更新(指定のURLを見て新しかったら更新してしまう)にしたいのですが……どうも難しそうですね http://kickjava.com/src/org/eclipse/update/ui/UpdateJob.java.htm -- [[通りすがりの傭兵]] &new{2008-03-18 (火) 13:44:15}; - ↑Pleiades入れればいいんじゃん……orz お騒がせしました -- [[通りすがりの傭兵]] &new{2008-03-21 (金) 10:57:07}; #comment #topicpath SIZE(10){現在のアクセス:&counter;}