diff options
author | Chris Goldthorpe | 2008-11-19 18:55:30 +0000 |
---|---|---|
committer | Chris Goldthorpe | 2008-11-19 18:55:30 +0000 |
commit | 04d3493da21f1ce2103d35eb6d57f0e319ff094d (patch) | |
tree | f1da81d5d62a55ad57ef104e5fd2e6e76113b64a /org.eclipse.ui.intro | |
parent | 386da6d750cebe811f44521b095157dcbf3b3c2a (diff) | |
download | eclipse.platform.ua-04d3493da21f1ce2103d35eb6d57f0e319ff094d.tar.gz eclipse.platform.ua-04d3493da21f1ce2103d35eb6d57f0e319ff094d.tar.xz eclipse.platform.ua-04d3493da21f1ce2103d35eb6d57f0e319ff094d.zip |
Bug 146237 [Intro] TVT3.2:Welcome page layout problem
Diffstat (limited to 'org.eclipse.ui.intro')
3 files changed, 57 insertions, 16 deletions
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IIntroHTMLConstants.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IIntroHTMLConstants.java index 6d0ed9729..7dc28187d 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IIntroHTMLConstants.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IIntroHTMLConstants.java @@ -43,6 +43,9 @@ public interface IIntroHTMLConstants { String ELEMENT_HR = "HR"; //$NON-NLS-1$ String ELEMENT_PARAGRAPH = "P"; //$NON-NLS-1$ String ELEMENT_STYLE = "STYLE"; //$NON-NLS-1$ + String ELEMENT_TABLE = "TABLE"; //$NON-NLS-1$ + String ELEMENT_TR = "TR"; //$NON-NLS-1$ + String ELEMENT_TD = "TD"; //$NON-NLS-1$ String ELEMENT_IFrame = "iFrame"; //$NON-NLS-1$ /* HTML attribute names */ diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IntroHTMLGenerator.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IntroHTMLGenerator.java index edb409294..7fbcb1007 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IntroHTMLGenerator.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IntroHTMLGenerator.java @@ -19,6 +19,7 @@ import java.io.StringWriter; import java.net.URL; import org.eclipse.core.runtime.Platform; +import org.eclipse.help.internal.base.BaseHelpSystem; import org.eclipse.ui.internal.intro.impl.FontSelection; import org.eclipse.ui.internal.intro.impl.IIntroConstants; import org.eclipse.ui.internal.intro.impl.IntroPlugin; @@ -421,38 +422,62 @@ public class IntroHTMLGenerator { * @return an anchor (<A>) HTMLElement */ private HTMLElement generateIntroLink(IntroLink element, int indentLevel) { - HTMLElement anchor = generateAnchorElement(element, indentLevel); + String styleId = element.getStyleId(); + boolean useTable = BaseHelpSystem.isRTL() && "content-link".equals(styleId); //$NON-NLS-1$ + HTMLElement anchor1 = generateAnchorElement(element, indentLevel); + HTMLElement anchor2 = null; + HTMLElement labelAnchor = anchor1; + int indentBase = indentLevel; + if (useTable) { + indentBase = indentLevel + 1; + anchor2 = generateAnchorElement(element, indentLevel + 1); + labelAnchor = anchor2; + } // add <IMG src="blank.gif"> String blankImageURL = BundleUtil.getResolvedResourceLocation(IIntroHTMLConstants.IMAGE_SRC_BLANK, IIntroConstants.PLUGIN_ID); if (blankImageURL != null) { - anchor.addContent(generateImageElement(blankImageURL, null, IIntroHTMLConstants.IMAGE_CLASS_BG, - indentLevel + 1)); + anchor1.addContent(generateImageElement(blankImageURL, null, IIntroHTMLConstants.IMAGE_CLASS_BG, + indentBase + 1)); } // add link image, if one is specified if (element.getImg() != null) { - HTMLElement img = generateIntroElement(element.getImg(), indentLevel + 1); + HTMLElement img = generateIntroElement(element.getImg(), indentBase + 1); if (img != null) - anchor.addContent(img); + anchor1.addContent(img); + } + if (!useTable) { + HTMLElement imageDiv = new FormattedHTMLElement(IIntroHTMLConstants.ELEMENT_DIV, indentBase+1, false); + imageDiv.addAttribute(IIntroHTMLConstants.ATTRIBUTE_CLASS, + IIntroHTMLConstants.LINK_EXTRA_DIV); + anchor1.addContent(imageDiv); } - HTMLElement imageDiv = new FormattedHTMLElement(IIntroHTMLConstants.ELEMENT_DIV, indentLevel+1, false); - imageDiv.addAttribute(IIntroHTMLConstants.ATTRIBUTE_CLASS, - IIntroHTMLConstants.LINK_EXTRA_DIV); - anchor.addContent(imageDiv); // add <SPAN class="link-label">linkLabel</SPAN> if (element.getLabel() != null) { HTMLElement label = generateSpanElement(IIntroHTMLConstants.SPAN_CLASS_LINK_LABEL, - indentLevel + 1); - label.addContent(element.getLabel()); - anchor.addContent(label); + indentBase + 2); + label.addContent(element.getLabel()); + labelAnchor.addContent(label); } IntroText linkText = element.getIntroText(); if (linkText != null && linkText.getText() != null) { - HTMLElement text = generateIntroElement(linkText, indentLevel + 1); + HTMLElement text = generateIntroElement(linkText, indentBase + 3); if (text != null) - anchor.addContent(text); + labelAnchor.addContent(text); } - return anchor; + if (!useTable) { + return anchor1; + } + HTMLElement table = new FormattedHTMLElement(IIntroHTMLConstants.ELEMENT_TABLE, indentLevel, false); + HTMLElement tr = new FormattedHTMLElement(IIntroHTMLConstants.ELEMENT_TR, indentLevel + 1, false); + table.addContent(tr); + HTMLElement td1 = new FormattedHTMLElement(IIntroHTMLConstants.ELEMENT_TD, indentLevel + 1, false); + HTMLElement td2 = new FormattedHTMLElement(IIntroHTMLConstants.ELEMENT_TD, indentLevel + 1, false); + tr.addContent(td1); + tr.addContent(td2); + td1.addContent(anchor1); + td2.addContent(anchor2); + return table; } /** @@ -872,10 +897,14 @@ public class IntroHTMLGenerator { span.addAttribute(IIntroHTMLConstants.ATTRIBUTE_CLASS, spanClass); if (spanContent != null) span.addContent(spanContent); + if (type != null) { // Create the enclosing text element: <P><SPAN>spanContent</SPAN></P> HTMLElement text = new FormattedHTMLElement(type, indentLevel, false); text.addContent(span); return text; + } else { + return span; + } } /** 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 f0ec1dd30..5f0b45009 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. + * Copyright (c) 2004, 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 @@ -26,6 +26,7 @@ import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.SafeRunner; import org.eclipse.help.UAContentFilter; import org.eclipse.help.internal.UAElementFactory; +import org.eclipse.help.internal.base.BaseHelpSystem; import org.eclipse.jface.util.SafeRunnable; import org.eclipse.ui.IPropertyListener; import org.eclipse.ui.internal.intro.impl.FontSelection; @@ -110,6 +111,7 @@ public class IntroModelRoot extends AbstractIntroContainer { private static final String ATT_CONTENT = "content"; //$NON-NLS-1$ private static final String ATT_CONFIGURER = "configurer"; //$NON-NLS-1$ private static final String VAR_THEME = "theme"; //$NON-NLS-1$ + private static final String VAR_DIRECTION = "direction"; //$NON-NLS-1$ // False if there is no valid contribution to the // org.eclipse.ui.intro.config extension point. Start off with true, and set @@ -943,6 +945,13 @@ public class IntroModelRoot extends AbstractIntroContainer { if (variable.equals(FontSelection.VAR_FONT_STYLE)) { return FontSelection.getFontStyle(); } + if (variable.equals(VAR_DIRECTION)) { + if (BaseHelpSystem.isRTL()) { + return "rtl"; //$NON-NLS-1$ + } else { + return "ltr"; //$NON-NLS-1$ + } + } if (configurer!=null) return configurer.getVariable(variable); |