- 追加された行はこの色です。
- 削除された行はこの色です。
----
SIZE(10){[[FrontPage]]}~
SIZE(10){現在のアクセス:&counter;}
#author("2021-12-14T02:32:33+00:00","","")
// 下階層用テンプレート
#topicpath
----
//ここにコンテンツを記述します。
イントロ画面(概要画面)とは、Eclipseを初めて起動したときに表示される、ワークベンチを覆う青い画面のことです。初めてアプリを使うヒトのための「ようこそ」画面ですね。
#ref(basicIntro.png)
#contents
***拡張ポイント [#sabf0d4e]
org.eclipse.ui.intro
後のorg.eclipse.ui.intro.config.CustomizableIntroPartなどを使う場合は、plugin.xmlで <import plugin="org.eclipse.ui.intro"/>
を追加してください。
***plugin.xmlのサンプル [#k2f912f9]
<extension point="org.eclipse.ui.intro">
<intro class="nu.mine.kino.plugin.samples.rcp.SampleIntroPart"
icon="icons/sample.gif"
id="nu.mine.kino.plugin.samples.rcp.intro1"/> <-イントロのID
<introProductBinding
introId="nu.mine.kino.plugin.samples.rcp.intro1" <-上のイントロのID
productId="nu.mine.kino.plugin.samples.rcp.product"/> <-rcpのproductID
</extension>
拡張ポイントに対応するJavaのインタフェースは
org.eclipse.ui.intro.IIntroPart
ですがEclipseが
org.eclipse.ui.part.IntroPart : 自分でウィジェットを置いていく場合
org.eclipse.ui.intro.config.CustomizableIntroPart : コンテンツxhtmlを読み込んで表示する場合
などを提供してくれています。
**やってみる [#cda82d81]
***例1 [#i684f795]
-plugin.xml
<extension point="org.eclipse.ui.intro">
<intro class="org.eclipse.ui.intro.config.CustomizableIntroPart"
icon="icons/sample.gif" ↑コンテンツxhtmlを使う
id="nu.mine.kino.plugin.samples.rcp.intro1"/>
<introProductBinding ↓イントロのID
introId="nu.mine.kino.plugin.samples.rcp.intro1"
productId="nu.mine.kino.plugin.samples.rcp.product"/>
</extension> ↑ このRCPプロダクトIDに適用する
<extension point="org.eclipse.ui.intro.config">
<config content="introContent.xml"
id="template01" <- configのID ↓さっきのイントロのID
introId="nu.mine.kino.plugin.samples.rcp.intro1">
<presentation home-page-id="root" >
<implementation kind="html"/>
</presentation>
</config>
</extension>
ここまでで、nu.mine.kino.plugin.samples.rcp.productというRCPプロダクトにintroContent.xmlというイントロ画面を追加する、という意味になりました。またhome-page-id="root"でintroContent.xml内のid="root"が初めのxhtmlですよ、ということを意味しています。
というわけで、引き続きintroContent.xmlです。
-introContent.xml
<?xml version="1.0" encoding="utf-8" ?>
<introContent>
<page id="root" content="content/root.xhtml"/> <-id="root"の記述
<page id="concept1" content="content/concept1.xhtml"/>
<page id="concept2" content="content/concept2.xhtml"/>
</introContent>
このid="root"のpage要素の記述で、イントロのトップページはcontent/root.xhtmlとなります。またrootというIDの他にも、concept1、concept2というページIDに対するxhtmlファイル名も定義してあります。
引き続きcontent/root.xhtmlです。
-content/root.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>root.xhtml</title>
<link rel="stylesheet" href="root.css" type="text/css" />
</head>
<body>
<h1>Welcome to Product A</h1>
<h4 id="firstH4">
<img border="0" src="welcome_item.gif" alt="Concept1" />
<a href="http://org.eclipse.ui.intro/showPage?id=concept1">Learn about Concept One...
</a> ↑ root.xhtmlで定義した別のページIDに遷移できるリンク
</h4>
<h4>
<img border="0" src="welcome_item.gif" alt="Concept2" />
<a href="http://org.eclipse.ui.intro/showPage?id=concept2">Learn about Concept Two...</a>
</h4>
<anchor id="anchor1" /> <-アンカー。ここにコンテンツを追加できる。後述。
</body>
</html>
ここまでで、ようやくroot.xhtmlがプロダクト概要として画面に表示されます。
#ref(phase1.png)
***例2 [#y4f11f14]
既存のイントロに、拡張ポイントを使ってコンテンツを追加する。
-plugin.xmlに追加
<extension point="org.eclipse.ui.intro.configExtension">
<configExtension configId="template01" content="ext.xml"/>
</extension> ↑拡張したいイントロのconfigを指定。さっきのconfigのID。
ext.xml は追加したい「定義」?
この拡張ポイントで、さっきのconfigのIDにext.xmlというコンテンツを追加する、という意味になります。さらにext.xmlは以下の通り:
-ext.xml
<?xml version="1.0" encoding="utf-8" ?>
<introContent> ↓追加したいxhtmlコンテンツを指定
<extensionContent content="content/extContent.xhtml" path="root/anchor1" />
<page id="concept3" content="content/concept3.xhtml"/> ↑pathはさっきのアンカーIDを指定
↑新たに、concept3というページIDを定義
</introContent>
まだなんか理解できていないですがpath="root/anchor1"のタグで、ページIDがrootで、その中のanchor1というアンカー(さっき後述といっていた)の場所に、content/extContent.xhtmlを追加で挿入する、という意味になります。また新たにconcept3というページIDを定義しています。
-extContent.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>root.xhtml</title>
<link rel="stylesheet" href="root.css" type="text/css" />
</head>
<body>
<h4>
<img border="0" src="welcome_item.gif" alt="Concept3" />
<a href="http://org.eclipse.ui.intro/showPage?id=concept3">Learn about Concept Three...</a>
</h4>
</body>
</html>
これでこのextContent.xhtmlの内容が、既存のイントロxhtml(root.xhtml)のanchor1の箇所に挿入されます。
#ref(phase2.png)
これってxhtmlがxmlだからこんな芸当ができるんですよねぇ。こんなEclipse作ったIBMもすごいけど、やっぱxhtml(xml)って偉大ですね。。。。
**TIPS [#zea0f041]
***イントロ画面を再表示する [#maf8a135]
消したイントロ画面を再表示するには
IWorkbench.getIntroManager()
.showIntro(IWorkbenchWindow preferredWindow,boolean standby)
をよべばよい。boolean standbyは、[[IIntroManagerのJavaDoc:http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/intro/IIntroManager.html]]によると''standby - true to put the intro part in its partially visible standy mode, and false to make it fully visible'' なので、全画面を覆い隠したい場合はfalse,一部分に出したい場合はtrueみたいです。
ちなみに、ActionFactoryから取得できる org.eclipse.ui.internal.IntroAction は
workbenchWindow.getWorkbench().getIntroManager().showIntro(
workbenchWindow, false);
となってましたね。
**関連リンク [#y167af3a]
-[[とりあえずメモ:http://www.jsurfer.de/modules.php?name=Forums&file=viewtopic&t=1329&start=0&postdays=0&postorder=asc&highlight=]] サンプルがありそう
-[[とりあえずメモ:http://www.eclipse.org/eclipse/platform-ua/proposals/xhtml/index.htm]] サンプルがありそう
Eclipseのヘルプを「概要部分の定義」で検索してヒットするページは非常に参考になります。イントロを作る場合は必見です。
----
この記事は
#vote(おもしろかった,そうでもない)
#vote(おもしろかった[7],そうでもない[1])
#comment
#topicpath
SIZE(10){現在のアクセス:&counter;}