diff options
author | mkersten | 2006-09-07 17:43:34 +0000 |
---|---|---|
committer | mkersten | 2006-09-07 17:43:34 +0000 |
commit | fab7fc72649fc9b970b6c73ef98aa922e73286b4 (patch) | |
tree | 1d71e730a810b5a2efa0157d5f27453254f9f3e9 /org.eclipse.mylyn.help.ui | |
parent | 1f93b919dadf3c44902357c614429feb9be8422e (diff) | |
download | org.eclipse.mylyn.tasks-fab7fc72649fc9b970b6c73ef98aa922e73286b4.tar.gz org.eclipse.mylyn.tasks-fab7fc72649fc9b970b6c73ef98aa922e73286b4.tar.xz org.eclipse.mylyn.tasks-fab7fc72649fc9b970b6c73ef98aa922e73286b4.zip |
Progress on: 152820: create visual design legend
https://bugs.eclipse.org/bugs/show_bug.cgi?id=152820
Diffstat (limited to 'org.eclipse.mylyn.help.ui')
-rw-r--r-- | org.eclipse.mylyn.help.ui/.classpath | 3 | ||||
-rw-r--r-- | org.eclipse.mylyn.help.ui/.project | 6 | ||||
-rw-r--r-- | org.eclipse.mylyn.help.ui/META-INF/MANIFEST.MF | 6 | ||||
-rw-r--r-- | org.eclipse.mylyn.help.ui/build.properties | 11 | ||||
-rw-r--r-- | org.eclipse.mylyn.help.ui/icons/etool16/icons-legend.gif | bin | 0 -> 617 bytes | |||
-rw-r--r-- | org.eclipse.mylyn.help.ui/plugin.xml | 37 | ||||
-rw-r--r-- | org.eclipse.mylyn.help.ui/src/org/eclipse/mylyn/doc/internal/actions/ShowMylarLegendAction.java | 44 | ||||
-rw-r--r-- | org.eclipse.mylyn.help.ui/src/org/eclipse/mylyn/doc/internal/dialogs/UiLegendDialog.java | 139 |
8 files changed, 243 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.help.ui/.classpath b/org.eclipse.mylyn.help.ui/.classpath index ddf0f401d..304e86186 100644 --- a/org.eclipse.mylyn.help.ui/.classpath +++ b/org.eclipse.mylyn.help.ui/.classpath @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/org.eclipse.mylyn.help.ui/.project b/org.eclipse.mylyn.help.ui/.project index 240934ada..cc9ad6c69 100644 --- a/org.eclipse.mylyn.help.ui/.project +++ b/org.eclipse.mylyn.help.ui/.project @@ -6,6 +6,11 @@ </projects> <buildSpec> <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> <name>org.eclipse.pde.ManifestBuilder</name> <arguments> </arguments> @@ -18,5 +23,6 @@ </buildSpec> <natures> <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> </natures> </projectDescription> diff --git a/org.eclipse.mylyn.help.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.help.ui/META-INF/MANIFEST.MF index 5f002a797..a66f5fa93 100644 --- a/org.eclipse.mylyn.help.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.mylyn.help.ui/META-INF/MANIFEST.MF @@ -6,3 +6,9 @@ Bundle-Version: 0.6.2.v20060828-1600 Bundle-Localization: plugin Eclipse-AutoStart: true Bundle-Vendor: Eclipse.org +Require-Bundle: org.eclipse.ui, + org.eclipse.ui.forms, + org.eclipse.mylar.tasks.ui +Export-Package: org.eclipse.mylar.doc.internal.actions, + org.eclipse.mylar.doc.internal.dialogs +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/org.eclipse.mylyn.help.ui/build.properties b/org.eclipse.mylyn.help.ui/build.properties index d5f13bafa..65c419a58 100644 --- a/org.eclipse.mylyn.help.ui/build.properties +++ b/org.eclipse.mylyn.help.ui/build.properties @@ -11,9 +11,16 @@ bin.includes = plugin.xml,\ META-INF/,\ doc/,\ - about.html + about.html,\ + .,\ + icons/ src.includes = META-INF/,\ plugin.xml,\ about.html,\ - doc/ + doc/,\ + src/,\ + icons/ +source.. = src/ +jars.compile.order = . +source.. = src/ diff --git a/org.eclipse.mylyn.help.ui/icons/etool16/icons-legend.gif b/org.eclipse.mylyn.help.ui/icons/etool16/icons-legend.gif Binary files differnew file mode 100644 index 000000000..f5d06ee86 --- /dev/null +++ b/org.eclipse.mylyn.help.ui/icons/etool16/icons-legend.gif diff --git a/org.eclipse.mylyn.help.ui/plugin.xml b/org.eclipse.mylyn.help.ui/plugin.xml index 20767a262..62be47ca0 100644 --- a/org.eclipse.mylyn.help.ui/plugin.xml +++ b/org.eclipse.mylyn.help.ui/plugin.xml @@ -11,4 +11,41 @@ primary="true"> </toc> </extension> + + <extension point="org.eclipse.ui.actionSets"> + <actionSet + id="org.eclipse.mylar.doc.actionSet" + label="Mylar Documentation" + visible="true"> + <action + class="org.eclipse.mylar.doc.internal.actions.ShowMylarLegendAction" + definitionId="org.eclipse.mylar.doc.legend.show" + icon="icons/etool16/icons-legend.gif" + id="org.eclipse.mylar.doc.legend.show.action" + label="Mylar UI Legend..." + menubarPath="help/helpStart" + style="push" + tooltip="Mylar UI Legend..."> + </action> + </actionSet> + </extension> + + <extension point="org.eclipse.ui.commands"> + <command + categoryId="org.eclipse.mylar.ui" + description="Show Mylar UI Legend" + id="org.eclipse.mylar.doc.legend.show" + name="Show Mylar UI Legend"> + </command> + </extension> + + <extension point="org.eclipse.ui.bindings"> + <key + sequence="M1+M2+M3+?" + contextId="org.eclipse.ui.globalScope" + commandId="org.eclipse.mylar.doc.legend.show" + schemeId ="org.eclipse.ui.defaultAcceleratorConfiguration"> + </key> + </extension> + </plugin> diff --git a/org.eclipse.mylyn.help.ui/src/org/eclipse/mylyn/doc/internal/actions/ShowMylarLegendAction.java b/org.eclipse.mylyn.help.ui/src/org/eclipse/mylyn/doc/internal/actions/ShowMylarLegendAction.java new file mode 100644 index 000000000..b79443889 --- /dev/null +++ b/org.eclipse.mylyn.help.ui/src/org/eclipse/mylyn/doc/internal/actions/ShowMylarLegendAction.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2004 - 2006 University Of British Columbia 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * University Of British Columbia - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylar.doc.internal.actions; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.mylar.doc.internal.dialogs.UiLegendDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; +import org.eclipse.ui.PlatformUI; + +/** + * @author Mik Kersten + */ +public class ShowMylarLegendAction implements IWorkbenchWindowActionDelegate { + + public void dispose() { + // ignore + } + + public void init(IWorkbenchWindow window) { + // ignore + } + + public void run(IAction action) { + Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + UiLegendDialog uiLegendDialog = new UiLegendDialog(parentShell); + uiLegendDialog.open(); + } + + public void selectionChanged(IAction action, ISelection selection) { + // ignore + } +} diff --git a/org.eclipse.mylyn.help.ui/src/org/eclipse/mylyn/doc/internal/dialogs/UiLegendDialog.java b/org.eclipse.mylyn.help.ui/src/org/eclipse/mylyn/doc/internal/dialogs/UiLegendDialog.java new file mode 100644 index 000000000..fa72b0cba --- /dev/null +++ b/org.eclipse.mylyn.help.ui/src/org/eclipse/mylyn/doc/internal/dialogs/UiLegendDialog.java @@ -0,0 +1,139 @@ +/******************************************************************************* + * Copyright (c) 2004 - 2006 University Of British Columbia 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * University Of British Columbia - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylar.doc.internal.dialogs; + +import org.eclipse.jface.dialogs.PopupDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.mylar.internal.tasks.ui.TaskListImages; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.forms.events.HyperlinkAdapter; +import org.eclipse.ui.forms.events.HyperlinkEvent; +import org.eclipse.ui.forms.widgets.Form; +import org.eclipse.ui.forms.widgets.FormToolkit; +import org.eclipse.ui.forms.widgets.ImageHyperlink; +import org.eclipse.ui.forms.widgets.Section; + +/** + * @author Mik Kersten + */ +public class UiLegendDialog extends PopupDialog { + + private static final String LABEL = "Mylar UI Legend"; + + private FormToolkit toolkit; + + private Form form; + + private Rectangle bounds; + + private Composite sectionClient; + + public UiLegendDialog(Shell parent) { + super(parent, PopupDialog.INFOPOPUP_SHELLSTYLE | SWT.ON_TOP, false, false, false, false, null, null); + } + + protected Control createContents(Composite parent) { + getShell().setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY)); + return createDialogArea(parent); + } + + protected final Control createDialogArea(final Composite parent) { + + getShell().setText("Mylar UI Legend"); + + toolkit = new FormToolkit(parent.getDisplay()); + form = toolkit.createForm(parent); + form.getBody().setLayout(new GridLayout()); + + Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR); + + section.setText(LABEL); + section.setLayout(new GridLayout()); + + sectionClient = toolkit.createComposite(section); + sectionClient.setLayout(new GridLayout(2, false)); + + String descriptionText = "xxxxxxxxxxxxxxx"; + Label descriptionLabel = toolkit.createLabel(sectionClient, descriptionText); + GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(descriptionLabel); + + section.setClient(sectionClient); + + Composite buttonsComposite = toolkit.createComposite(section); + section.setTextClient(buttonsComposite); + buttonsComposite.setLayout(new RowLayout()); + buttonsComposite.setBackground(section.getTitleBarBackground()); + final ImageHyperlink closeHyperlink = toolkit.createImageHyperlink(buttonsComposite, SWT.NONE); + // closeHyperlink.setBackgroundMode(SWT.INHERIT_FORCE); + closeHyperlink.setBackground(section.getTitleBarBackground()); + closeHyperlink.setImage(TaskListImages.getImage(TaskListImages.NOTIFICATION_CLOSE)); + closeHyperlink.addHyperlinkListener(new HyperlinkAdapter() { + public void linkActivated(HyperlinkEvent e) { + close(); + } + }); + + form.pack(); + return parent; + } + + /** + * Initialize the shell's bounds. + */ + public void initializeBounds() { + getShell().setBounds(restoreBounds()); + } + + private Rectangle restoreBounds() { + bounds = form.getBounds(); + Rectangle maxBounds = null; + if (getShell() != null && !getShell().isDisposed()) + maxBounds = getShell().getDisplay().getClientArea(); + else { + // fallback + Display display = Display.getCurrent(); + if (display == null) + display = Display.getDefault(); + if (display != null && !display.isDisposed()) + maxBounds = display.getBounds(); + } + + if (bounds.width > -1 && bounds.height > -1) { + if (maxBounds != null) { + bounds.width = Math.min(bounds.width, maxBounds.width); + bounds.height = Math.min(bounds.height, maxBounds.height); + } + // Enforce an absolute minimal size + bounds.width = Math.max(bounds.width, 30); + bounds.height = Math.max(bounds.height, 30); + } + + if (bounds.x > -1 && bounds.y > -1 && maxBounds != null) { + bounds.x = Math.max(bounds.x, maxBounds.x); + bounds.y = Math.max(bounds.y, maxBounds.y); + + if (bounds.width > -1 && bounds.height > -1) { + bounds.x = maxBounds.width - bounds.width; + bounds.y = maxBounds.height - bounds.height; + } + } + return bounds; + } +} |