diff options
Diffstat (limited to 'org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/LaunchBarElement.java')
-rw-r--r-- | org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/LaunchBarElement.java | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/LaunchBarElement.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/LaunchBarElement.java index 9560f3d82..6a069411f 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/LaunchBarElement.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/LaunchBarElement.java @@ -13,7 +13,9 @@ package org.eclipse.ui.internal.intro.impl.model; import java.util.ArrayList; import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.SWT; +import org.eclipse.ui.internal.intro.impl.util.ImageUtil; import org.osgi.framework.Bundle; import org.w3c.dom.Element; @@ -30,8 +32,11 @@ public class LaunchBarElement extends AbstractIntroElement { private static final String ATT_LOCATION = "location"; //$NON-NLS-1$ private static final String ATT_BG = "bg"; //$NON-NLS-1$ private static final String ATT_FG = "fg"; //$NON-NLS-1$ - + private static final String ATT_CLOSE = "close"; //$NON-NLS-1$ + private static final String ATT_IMAGE = "image"; //$NON-NLS-1$ + private static final String TAG_SHORTCUT = "shortcut"; //$NON-NLS-1$ + private static final String TAG_HANDLE = "handle"; //$NON-NLS-1$ private ArrayList shortcuts; @@ -89,6 +94,52 @@ public class LaunchBarElement extends AbstractIntroElement { public String getForeground() { return getCfgElement().getAttribute(ATT_FG); } + + public boolean getCreateHandle() { + return getHandleElement()!=null; + } + + public boolean getClose() { + IConfigurationElement handle = getHandleElement(); + if (handle!=null) { + String value = handle.getAttribute(ATT_CLOSE); + return value==null || value.equals("true"); + } + return true; + } + + /** + * Returns the relative icon path of the handle image. + * + * @return + */ + private String getHandleImage() { + IConfigurationElement handle = getHandleElement(); + if (handle==null) + return null; + return handle.getAttribute(ATT_IMAGE); + } + + /** + * Returns the icon image of the handle, or <code>null</code> if not + * defined or found. + * + * @return + */ + public ImageDescriptor getHandleImageDescriptor() { + String path = getHandleImage(); + if (path==null) + return null; + return ImageUtil.createImageDescriptor(getBundle(), path); + } + + private IConfigurationElement getHandleElement() { + IConfigurationElement[] children = getCfgElement().getChildren( + TAG_HANDLE); + if (children.length>0) + return children[0]; + return null; + } /** * Returns an array of shorcut elements. |