Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.ui.intro/schema/IntroContent.exsd4
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractBaseIntroElement.java4
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPage.java46
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java7
4 files changed, 42 insertions, 19 deletions
diff --git a/org.eclipse.ui.intro/schema/IntroContent.exsd b/org.eclipse.ui.intro/schema/IntroContent.exsd
index 3ad6607e3..d9b583b76 100644
--- a/org.eclipse.ui.intro/schema/IntroContent.exsd
+++ b/org.eclipse.ui.intro/schema/IntroContent.exsd
@@ -90,8 +90,8 @@ A <b>group</b> subelement is used to group of content and apply styl
<attribute name="content" type="string">
<annotation>
<documentation>
- an optional attribute which can define the location of an introContent.xml file that represents the content of this page. When defined all attributes in this page element are honored, but all children are ignored. This is because the content of this page is now assumed to reside in the xml files pointed to by the content file. It is also assumed that this new file has only one page deifned, and so when resolving to content of this file, the first page is loaded.
-This seperation out of pages can be used when performance is an issue, as the content of a page is now only loaded when really needed.
+ an optional attribute which can define the location of an introContent.xml file that represents the content of this page. When defined all attributes in this page element, except id, are ignored. This is because the content of this page is now assumed to reside in the xml files pointed to by the content file. It is also assumed that this new file has only one page deifned. When resolving to the content of this file, the page with a matching is to the id defined in this page is chosen.
+This seperation out of pages can be used when performance is an issue, as the content of a page is now loaded more lazily.
</documentation>
</annotation>
</attribute>
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractBaseIntroElement.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractBaseIntroElement.java
index d8a5258c7..46a1599bd 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractBaseIntroElement.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractBaseIntroElement.java
@@ -30,8 +30,8 @@ import org.w3c.dom.*;
*/
public abstract class AbstractBaseIntroElement extends AbstractIntroIdElement {
- private static final String ATT_STYLE_ID = "style-id"; //$NON-NLS-1$
- private static final String ATT_FIlTERED_FROM = "filteredFrom"; //$NON-NLS-1$
+ protected static final String ATT_STYLE_ID = "style-id"; //$NON-NLS-1$
+ protected static final String ATT_FIlTERED_FROM = "filteredFrom"; //$NON-NLS-1$
protected String style_id;
protected String filteredFrom;
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPage.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPage.java
index 0206b14d4..a38590334 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPage.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPage.java
@@ -63,15 +63,26 @@ public abstract class AbstractIntroPage extends AbstractIntroContainer {
*/
AbstractIntroPage(Element element, Bundle bundle) {
super(element, bundle);
+ content = getAttribute(element, ATT_CONTENT);
+ if (content == null)
+ init(element, bundle);
+ else
+ // Content is not null. Resolve it. Other attributes will be loaded
+ // when xml content file is loaded
+ content = IntroModelRoot.getPluginLocation(content, bundle);
+ }
+
+ private void init(Element element, Bundle bundle) {
style = getAttribute(element, ATT_STYLE);
altStyle = getAttribute(element, ATT_ALT_STYLE);
- content = getAttribute(element, ATT_CONTENT);
+
// Resolve.
style = IntroModelRoot.getPluginLocation(style, bundle);
altStyle = IntroModelRoot.getPluginLocation(altStyle, bundle);
- content = IntroModelRoot.getPluginLocation(content, bundle);
+
}
+
/**
* The page's title. Each page can have one title.
*
@@ -233,7 +244,9 @@ public abstract class AbstractIntroPage extends AbstractIntroContainer {
/**
* load the children of this container. Override parent behavior because we
- * want to support laoding content from other xml files.
+ * want to support loading content from other xml files. The design is that
+ * only the id and content from the existing page are honored. all other
+ * attributes are what they are defined in the external page.
*
* @return Returns all the children of this container.
*/
@@ -252,16 +265,27 @@ public abstract class AbstractIntroPage extends AbstractIntroContainer {
Element[] pages = ModelLoaderUtil.getElementsByTagName(dom,
IntroPage.TAG_PAGE);
- if (pages.length != 1) {
- String message = StringUtil.concat("Content file for page: ",
- getId(), " has ", String.valueOf(pages.length), " pages")
- .toString();
- Log.warning(message);
- // return empty array.
+ if (pages.length == 0) {
+ Log.warning("Content file has no pages.");
return;
}
- // point the element of this page to the new element.
- this.element = pages[0];
+ // point the element of this page to the new element. Pick first page
+ // with matching id.
+ for (int i = 0; i < pages.length; i++) {
+ Element pageElement = pages[i];
+ if (pageElement.getAttribute(IntroPage.ATT_ID).equals(getId())) {
+ this.element = pageElement;
+ // call init on the new element. the filtering and the style-id
+ // are loaded by the parent class.
+ init(pageElement, getBundle());
+ // TODO: revisit.
+ style_id = element
+ .getAttribute(AbstractBaseIntroElement.ATT_STYLE_ID);
+ filteredFrom = element
+ .getAttribute(AbstractBaseIntroElement.ATT_FIlTERED_FROM);
+
+ }
+ }
// now do children loading as usual.
super.loadChildren();
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java
index a77d6e4af..2790a4625 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java
@@ -202,15 +202,14 @@ public class IntroModelRoot extends AbstractIntroContainer {
IntroPage.TAG_PAGE);
for (int i = 0; i < pages.length; i++) {
Element pageElement = pages[i];
- if (pageElement.getAttribute(IntroPage.ATT_ID).equalsIgnoreCase(
- homePageId)) {
+ if (pageElement.getAttribute(IntroPage.ATT_ID).equals(homePageId)) {
// Create the model class for the Root Page.
homePage = new IntroHomePage(pageElement, bundle);
homePage.setParent(this);
currentPageId = homePage.getId();
children.add(homePage);
- } else if (pageElement.getAttribute(IntroPage.ATT_ID)
- .equalsIgnoreCase(standbyPageId)) {
+ } else if (pageElement.getAttribute(IntroPage.ATT_ID).equals(
+ standbyPageId)) {
// Create the model class for the standby Page.
standbyPage = new IntroHomePage(pageElement, bundle);
standbyPage.setParent(this);

Back to the top