diff options
author | Eike Stepper | 2009-04-26 16:52:43 +0000 |
---|---|---|
committer | Eike Stepper | 2009-04-26 16:52:43 +0000 |
commit | 75b5e955a062d69c87d49975e2292688fae47a88 (patch) | |
tree | 2243cf53ec5dfebe933905ecf452d0343745a291 /plugins/org.gastro.rcp.table | |
parent | d2fb30e856c3bd7d0bdc0ebdd66c2b7bb5a632b0 (diff) | |
download | cdo-75b5e955a062d69c87d49975e2292688fae47a88.tar.gz cdo-75b5e955a062d69c87d49975e2292688fae47a88.tar.xz cdo-75b5e955a062d69c87d49975e2292688fae47a88.zip |
[273726] Publish "Gastro" Examples
https://bugs.eclipse.org/bugs/show_bug.cgi?id=273726
Diffstat (limited to 'plugins/org.gastro.rcp.table')
36 files changed, 2687 insertions, 0 deletions
diff --git a/plugins/org.gastro.rcp.table/.classpath b/plugins/org.gastro.rcp.table/.classpath new file mode 100644 index 0000000000..64c5e31b7a --- /dev/null +++ b/plugins/org.gastro.rcp.table/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <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="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/org.gastro.rcp.table/.cvsignore b/plugins/org.gastro.rcp.table/.cvsignore new file mode 100644 index 0000000000..693869726d --- /dev/null +++ b/plugins/org.gastro.rcp.table/.cvsignore @@ -0,0 +1,2 @@ +bin +doc diff --git a/plugins/org.gastro.rcp.table/.project b/plugins/org.gastro.rcp.table/.project new file mode 100644 index 0000000000..4ee8e319b2 --- /dev/null +++ b/plugins/org.gastro.rcp.table/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.gastro.internal.rcp.table</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/plugins/org.gastro.rcp.table/.settings/org.eclipse.jdt.core.prefs b/plugins/org.gastro.rcp.table/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..4efc826b5e --- /dev/null +++ b/plugins/org.gastro.rcp.table/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Apr 10 11:43:14 CEST 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/plugins/org.gastro.rcp.table/GastroTable1.launch b/plugins/org.gastro.rcp.table/GastroTable1.launch new file mode 100644 index 0000000000..b9d8d71c5d --- /dev/null +++ b/plugins/org.gastro.rcp.table/GastroTable1.launch @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench"> +<booleanAttribute key="append.args" value="true"/> +<booleanAttribute key="askclear" value="true"/> +<booleanAttribute key="automaticAdd" value="false"/> +<booleanAttribute key="automaticValidate" value="false"/> +<stringAttribute key="bootstrap" value=""/> +<stringAttribute key="checked" value="org.eclipse.emf.cdo,org.eclipse.emf.cdo.common,org.eclipse.net4j,org.eclipse.net4j.tcp,org.eclipse.net4j.util"/> +<booleanAttribute key="clearConfig" value="false"/> +<booleanAttribute key="clearws" value="false"/> +<booleanAttribute key="clearwslog" value="false"/> +<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/GastroTable1"/> +<booleanAttribute key="default" value="false"/> +<booleanAttribute key="includeOptional" value="true"/> +<stringAttribute key="location" value="${workspace_loc}/../gastro.table1.rt"/> +<listAttribute key="org.eclipse.debug.ui.favoriteGroups"> +<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/> +<listEntry value="com.yourkit.profiler.launchGroup"/> +<listEntry value="org.eclipse.debug.ui.launchGroup.run"/> +</listAttribute> +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -debug -console -consolelog"/> +<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> +<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Ddebug=true -Dgastro.config=${workspace_loc:/org.gastro.rcp.table/config/table1.properties}"/> +<booleanAttribute key="pde.generated.config" value="false"/> +<stringAttribute key="pde.version" value="3.3"/> +<stringAttribute key="product" value="org.gastro.rcp.product"/> +<stringAttribute key="selectedPlugin" value="org.eclipse.net4j.util"/> +<stringAttribute key="selected_target_plugins" value="org.eclipse.text@default:default,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.swt.win32.win32.x86@default:false,org.eclipse.osgi.services@default:default,org.eclipse.ecf@default:default,org.eclipse.emf.ecore.edit@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.resources.win32.x86@default:false,org.eclipse.ui.workbench@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.jface@default:default,org.eclipse.core.commands@default:default,org.eclipse.ui.win32@default:false,org.eclipse.core.variables@default:default,org.eclipse.core.expressions@default:default,org.eclipse.emf.common@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.help@default:default,org.eclipse.equinox.app@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.edit.ui@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.emf.ecore.change@default:default,com.ibm.icu@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface.text@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.emf.common.ui@default:default,org.eclipse.equinox.common@default:default,org.eclipse.team.core@default:default,javax.servlet@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.equinox.registry@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.swt@default:default,org.eclipse.equinox.security@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.resources@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.core.resources.compatibility@default:false,org.eclipse.core.jobs@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.ui.views@default:default,org.eclipse.ui.forms@default:default,org.eclipse.emf.edit@default:default,org.eclipse.core.runtime@default:true,org.eclipse.ui@default:default,org.eclipse.osgi@default:default,org.eclipse.ui.ide@default:default,org.eclipse.emf.ecore@default:default"/> +<stringAttribute key="selected_workspace_plugins" value="org.gastro.inventory.edit@default:default,org.gastro.business@default:default,org.gastro.rcp@default:default,org.eclipse.emf.cdo.common@default:default,org.gastro.rcp.table@default:default,org.eclipse.net4j.util@default:default,org.eclipse.emf.cdo@default:default,org.eclipse.emf.cdo.edit@default:default,org.eclipse.net4j.tcp@default:default,org.gastro.business.edit@default:default,org.gastro.inventory@default:default,org.eclipse.net4j@default:default"/> +<booleanAttribute key="show_selected_only" value="false"/> +<booleanAttribute key="tracing" value="true"/> +<booleanAttribute key="useDefaultConfig" value="true"/> +<booleanAttribute key="useDefaultConfigArea" value="true"/> +<booleanAttribute key="useProduct" value="true"/> +<booleanAttribute key="usefeatures" value="false"/> +</launchConfiguration> diff --git a/plugins/org.gastro.rcp.table/GastroTable2.launch b/plugins/org.gastro.rcp.table/GastroTable2.launch new file mode 100644 index 0000000000..3469e3e46b --- /dev/null +++ b/plugins/org.gastro.rcp.table/GastroTable2.launch @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench"> +<booleanAttribute key="append.args" value="true"/> +<booleanAttribute key="askclear" value="true"/> +<booleanAttribute key="automaticAdd" value="false"/> +<booleanAttribute key="automaticValidate" value="false"/> +<stringAttribute key="bootstrap" value=""/> +<stringAttribute key="checked" value="org.eclipse.emf.cdo,org.eclipse.emf.cdo.common,org.eclipse.net4j,org.eclipse.net4j.tcp,org.eclipse.net4j.util"/> +<booleanAttribute key="clearConfig" value="false"/> +<booleanAttribute key="clearws" value="false"/> +<booleanAttribute key="clearwslog" value="false"/> +<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/GastroTable2"/> +<booleanAttribute key="default" value="false"/> +<booleanAttribute key="includeOptional" value="true"/> +<stringAttribute key="location" value="${workspace_loc}/../gastro.table2.rt"/> +<listAttribute key="org.eclipse.debug.ui.favoriteGroups"> +<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/> +<listEntry value="com.yourkit.profiler.launchGroup"/> +<listEntry value="org.eclipse.debug.ui.launchGroup.run"/> +</listAttribute> +<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -debug -console -consolelog"/> +<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> +<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Ddebug=true -Dgastro.config=${workspace_loc:/org.gastro.rcp.table/config/table2.properties}"/> +<booleanAttribute key="pde.generated.config" value="false"/> +<stringAttribute key="pde.version" value="3.3"/> +<stringAttribute key="product" value="org.gastro.rcp.product"/> +<stringAttribute key="selectedPlugin" value="org.eclipse.net4j.util"/> +<stringAttribute key="selected_target_plugins" value="org.eclipse.jface.text@default:default,org.eclipse.help@default:default,org.eclipse.osgi.services@default:default,org.eclipse.equinox.security@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.common@default:default,org.eclipse.ui.views@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.ui.ide@default:default,org.eclipse.ui@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.team.core@default:default,org.eclipse.core.resources.win32.x86@default:false,org.eclipse.swt.win32.win32.x86@default:false,org.eclipse.emf.ecore.edit@default:default,org.eclipse.core.databinding@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.ui.forms@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.edit.ui@default:default,com.ibm.icu@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ui.win32@default:false,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.swt@default:default,org.eclipse.emf.common.ui@default:default,org.eclipse.core.resources.compatibility@default:false,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.osgi@default:default,org.eclipse.core.variables@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.text@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.core.filesystem@default:default,javax.servlet@default:default,org.eclipse.core.resources@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.commands@default:default,org.eclipse.jface@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.core.runtime@default:true,org.eclipse.emf.edit@default:default"/> +<stringAttribute key="selected_workspace_plugins" value="org.eclipse.emf.cdo@default:default,org.eclipse.emf.cdo.edit@default:default,org.eclipse.net4j.util@default:default,org.gastro.inventory.edit@default:default,org.eclipse.net4j.tcp@default:default,org.gastro.inventory@default:default,org.gastro.rcp@default:default,org.eclipse.net4j@default:default,org.gastro.business@default:default,org.eclipse.emf.cdo.common@default:default,org.gastro.business.edit@default:default,org.gastro.rcp.table@default:default"/> +<booleanAttribute key="show_selected_only" value="false"/> +<booleanAttribute key="tracing" value="true"/> +<booleanAttribute key="useDefaultConfig" value="true"/> +<booleanAttribute key="useDefaultConfigArea" value="true"/> +<booleanAttribute key="useProduct" value="true"/> +<booleanAttribute key="usefeatures" value="false"/> +</launchConfiguration> diff --git a/plugins/org.gastro.rcp.table/META-INF/MANIFEST.MF b/plugins/org.gastro.rcp.table/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..c3fb1ff488 --- /dev/null +++ b/plugins/org.gastro.rcp.table/META-INF/MANIFEST.MF @@ -0,0 +1,10 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Gastro Table +Bundle-SymbolicName: org.gastro.rcp.table; singleton:=true +Bundle-Version: 1.0.0 +Bundle-Activator: org.gastro.rcp.internal.table.Activator +Require-Bundle: org.gastro.rcp;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Vendor: www.gastro.org diff --git a/plugins/org.gastro.rcp.table/build.properties b/plugins/org.gastro.rcp.table/build.properties new file mode 100644 index 0000000000..03355b7b1b --- /dev/null +++ b/plugins/org.gastro.rcp.table/build.properties @@ -0,0 +1,12 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + icons/,\ + images/,\ + copyright.txt,\ + epl-v10.html,\ + license.html,\ + GastroTable2.launch,\ + GastroTable1.launch diff --git a/plugins/org.gastro.rcp.table/config/table1.properties b/plugins/org.gastro.rcp.table/config/table1.properties new file mode 100644 index 0000000000..3ba1c9ec71 --- /dev/null +++ b/plugins/org.gastro.rcp.table/config/table1.properties @@ -0,0 +1,5 @@ +perspective = table +station = Tisch 1 +server = localhost:2036 +repository = gastro +restaurant = eDine diff --git a/plugins/org.gastro.rcp.table/config/table2.properties b/plugins/org.gastro.rcp.table/config/table2.properties new file mode 100644 index 0000000000..127d016216 --- /dev/null +++ b/plugins/org.gastro.rcp.table/config/table2.properties @@ -0,0 +1,5 @@ +perspective = table +station = Tisch 2 +server = localhost:2036 +repository = gastro +restaurant = eDine diff --git a/plugins/org.gastro.rcp.table/copyright.txt b/plugins/org.gastro.rcp.table/copyright.txt new file mode 100644 index 0000000000..d7088ff84e --- /dev/null +++ b/plugins/org.gastro.rcp.table/copyright.txt @@ -0,0 +1,11 @@ +Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) 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: + Eike Stepper - initial API and implementation + +Initial Publication: + Eclipse Magazin - http://www.eclipse-magazin.de
\ No newline at end of file diff --git a/plugins/org.gastro.rcp.table/epl-v10.html b/plugins/org.gastro.rcp.table/epl-v10.html new file mode 100644 index 0000000000..d7b88e9416 --- /dev/null +++ b/plugins/org.gastro.rcp.table/epl-v10.html @@ -0,0 +1,319 @@ +<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head> +<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> +<meta name="ProgId" content="Word.Document"> +<meta name="Generator" content="Microsoft Word 9"> +<meta name="Originator" content="Microsoft Word 9"> +<link rel="File-List" href="http://www.eclipse.org/org/documents/Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml"><title>Eclipse Public License - Version 1.0</title><!--[if gte mso 9]><xml> + <o:DocumentProperties> + <o:Revision>2</o:Revision> + <o:TotalTime>3</o:TotalTime> + <o:Created>2004-03-05T23:03:00Z</o:Created> + <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved> + <o:Pages>4</o:Pages> + <o:Words>1626</o:Words> + <o:Characters>9270</o:Characters> + <o:Lines>77</o:Lines> + <o:Paragraphs>18</o:Paragraphs> + <o:CharactersWithSpaces>11384</o:CharactersWithSpaces> + <o:Version>9.4402</o:Version> + </o:DocumentProperties> +</xml><![endif]--><!--[if gte mso 9]><xml> + <w:WordDocument> + <w:TrackRevisions/> + </w:WordDocument> +</xml><![endif]--> + + +<style> +<!-- + /* Font Definitions */ +@font-face + {font-family:Tahoma; + panose-1:2 11 6 4 3 5 4 4 2 4; + mso-font-charset:0; + mso-generic-font-family:swiss; + mso-font-pitch:variable; + mso-font-signature:553679495 -2147483648 8 0 66047 0;} + /* Style Definitions */ +p.MsoNormal, li.MsoNormal, div.MsoNormal + {mso-style-parent:""; + margin:0in; + margin-bottom:.0001pt; + mso-pagination:widow-orphan; + font-size:12.0pt; + font-family:"Times New Roman"; + mso-fareast-font-family:"Times New Roman";} +p + {margin-right:0in; + mso-margin-top-alt:auto; + mso-margin-bottom-alt:auto; + margin-left:0in; + mso-pagination:widow-orphan; + font-size:12.0pt; + font-family:"Times New Roman"; + mso-fareast-font-family:"Times New Roman";} +p.BalloonText, li.BalloonText, div.BalloonText + {mso-style-name:"Balloon Text"; + margin:0in; + margin-bottom:.0001pt; + mso-pagination:widow-orphan; + font-size:8.0pt; + font-family:Tahoma; + mso-fareast-font-family:"Times New Roman";} +@page Section1 + {size:8.5in 11.0in; + margin:1.0in 1.25in 1.0in 1.25in; + mso-header-margin:.5in; + mso-footer-margin:.5in; + mso-paper-source:0;} +div.Section1 + {page:Section1;} +--> +</style></head> + +<body style="" lang="EN-US"> + +<div class="Section1"> + +<p style="text-align: center;" align="center"><b>Eclipse Public License - v 1.0</b> +</p> + +<p><span style="font-size: 10pt;">THE ACCOMPANYING PROGRAM IS PROVIDED UNDER +THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, +REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE +OF THIS AGREEMENT.</span> </p> + +<p><b><span style="font-size: 10pt;">1. DEFINITIONS</span></b> </p> + +<p><span style="font-size: 10pt;">"Contribution" means:</span> </p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a) +in the case of the initial Contributor, the initial code and documentation +distributed under this Agreement, and<br clear="left"> +b) in the case of each subsequent Contributor:</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">i) +changes to the Program, and</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">ii) +additions to the Program;</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">where +such changes and/or additions to the Program originate from and are distributed +by that particular Contributor. A Contribution 'originates' from a Contributor +if it was added to the Program by such Contributor itself or anyone acting on +such Contributor's behalf. Contributions do not include additions to the +Program which: (i) are separate modules of software distributed in conjunction +with the Program under their own license agreement, and (ii) are not derivative +works of the Program. </span></p> + +<p><span style="font-size: 10pt;">"Contributor" means any person or +entity that distributes the Program.</span> </p> + +<p><span style="font-size: 10pt;">"Licensed Patents " mean patent +claims licensable by a Contributor which are necessarily infringed by the use +or sale of its Contribution alone or when combined with the Program. </span></p> + +<p><span style="font-size: 10pt;">"Program" means the Contributions +distributed in accordance with this Agreement.</span> </p> + +<p><span style="font-size: 10pt;">"Recipient" means anyone who +receives the Program under this Agreement, including all Contributors.</span> </p> + +<p><b><span style="font-size: 10pt;">2. GRANT OF RIGHTS</span></b> </p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a) +Subject to the terms of this Agreement, each Contributor hereby grants Recipient +a non-exclusive, worldwide, royalty-free copyright license to<span style="color: red;"> </span>reproduce, prepare derivative works of, publicly +display, publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and object code +form.</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b) +Subject to the terms of this Agreement, each Contributor hereby grants +Recipient a non-exclusive, worldwide,<span style="color: green;"> </span>royalty-free +patent license under Licensed Patents to make, use, sell, offer to sell, import +and otherwise transfer the Contribution of such Contributor, if any, in source +code and object code form. This patent license shall apply to the combination +of the Contribution and the Program if, at the time the Contribution is added +by the Contributor, such addition of the Contribution causes such combination +to be covered by the Licensed Patents. The patent license shall not apply to +any other combinations which include the Contribution. No hardware per se is +licensed hereunder. </span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">c) +Recipient understands that although each Contributor grants the licenses to its +Contributions set forth herein, no assurances are provided by any Contributor +that the Program does not infringe the patent or other intellectual property +rights of any other entity. Each Contributor disclaims any liability to Recipient +for claims brought by any other entity based on infringement of intellectual +property rights or otherwise. As a condition to exercising the rights and +licenses granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For example, +if a third party patent license is required to allow Recipient to distribute +the Program, it is Recipient's responsibility to acquire that license before +distributing the Program.</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">d) +Each Contributor represents that to its knowledge it has sufficient copyright +rights in its Contribution, if any, to grant the copyright license set forth in +this Agreement. </span></p> + +<p><b><span style="font-size: 10pt;">3. REQUIREMENTS</span></b> </p> + +<p><span style="font-size: 10pt;">A Contributor may choose to distribute the +Program in object code form under its own license agreement, provided that:</span> +</p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a) +it complies with the terms and conditions of this Agreement; and</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b) +its license agreement:</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">i) +effectively disclaims on behalf of all Contributors all warranties and +conditions, express and implied, including warranties or conditions of title +and non-infringement, and implied warranties or conditions of merchantability +and fitness for a particular purpose; </span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">ii) +effectively excludes on behalf of all Contributors all liability for damages, +including direct, indirect, special, incidental and consequential damages, such +as lost profits; </span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">iii) +states that any provisions which differ from this Agreement are offered by that +Contributor alone and not by any other party; and</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">iv) +states that source code for the Program is available from such Contributor, and +informs licensees how to obtain it in a reasonable manner on or through a +medium customarily used for software exchange.<span style="color: blue;"> </span></span></p> + +<p><span style="font-size: 10pt;">When the Program is made available in source +code form:</span> </p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a) +it must be made available under this Agreement; and </span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b) a +copy of this Agreement must be included with each copy of the Program. </span></p> + +<p><span style="font-size: 10pt;">Contributors may not remove or alter any +copyright notices contained within the Program. </span></p> + +<p><span style="font-size: 10pt;">Each Contributor must identify itself as the +originator of its Contribution, if any, in a manner that reasonably allows +subsequent Recipients to identify the originator of the Contribution. </span></p> + +<p><b><span style="font-size: 10pt;">4. COMMERCIAL DISTRIBUTION</span></b> </p> + +<p><span style="font-size: 10pt;">Commercial distributors of software may +accept certain responsibilities with respect to end users, business partners +and the like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a commercial +product offering should do so in a manner which does not create potential +liability for other Contributors. Therefore, if a Contributor includes the +Program in a commercial product offering, such Contributor ("Commercial +Contributor") hereby agrees to defend and indemnify every other +Contributor ("Indemnified Contributor") against any losses, damages and +costs (collectively "Losses") arising from claims, lawsuits and other +legal actions brought by a third party against the Indemnified Contributor to +the extent caused by the acts or omissions of such Commercial Contributor in +connection with its distribution of the Program in a commercial product +offering. The obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. In order +to qualify, an Indemnified Contributor must: a) promptly notify the Commercial +Contributor in writing of such claim, and b) allow the Commercial Contributor +to control, and cooperate with the Commercial Contributor in, the defense and +any related settlement negotiations. The Indemnified Contributor may participate +in any such claim at its own expense.</span> </p> + +<p><span style="font-size: 10pt;">For example, a Contributor might include the +Program in a commercial product offering, Product X. That Contributor is then a +Commercial Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance claims and +warranties are such Commercial Contributor's responsibility alone. Under this +section, the Commercial Contributor would have to defend claims against the +other Contributors related to those performance claims and warranties, and if a +court requires any other Contributor to pay any damages as a result, the +Commercial Contributor must pay those damages.</span> </p> + +<p><b><span style="font-size: 10pt;">5. NO WARRANTY</span></b> </p> + +<p><span style="font-size: 10pt;">EXCEPT AS EXPRESSLY SET FORTH IN THIS +AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, +WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, +MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and distributing the +Program and assumes all risks associated with its exercise of rights under this +Agreement , including but not limited to the risks and costs of program errors, +compliance with applicable laws, damage to or loss of data, programs or +equipment, and unavailability or interruption of operations. </span></p> + +<p><b><span style="font-size: 10pt;">6. DISCLAIMER OF LIABILITY</span></b> </p> + +<p><span style="font-size: 10pt;">EXCEPT AS EXPRESSLY SET FORTH IN THIS +AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF +THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGES.</span> </p> + +<p><b><span style="font-size: 10pt;">7. GENERAL</span></b> </p> + +<p><span style="font-size: 10pt;">If any provision of this Agreement is invalid +or unenforceable under applicable law, it shall not affect the validity or +enforceability of the remainder of the terms of this Agreement, and without +further action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable.</span> </p> + +<p><span style="font-size: 10pt;">If Recipient institutes patent litigation +against any entity (including a cross-claim or counterclaim in a lawsuit) +alleging that the Program itself (excluding combinations of the Program with +other software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of the date +such litigation is filed. </span></p> + +<p><span style="font-size: 10pt;">All Recipient's rights under this Agreement +shall terminate if it fails to comply with any of the material terms or +conditions of this Agreement and does not cure such failure in a reasonable +period of time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use and +distribution of the Program as soon as reasonably practicable. However, +Recipient's obligations under this Agreement and any licenses granted by +Recipient relating to the Program shall continue and survive. </span></p> + +<p><span style="font-size: 10pt;">Everyone is permitted to copy and distribute +copies of this Agreement, but in order to avoid inconsistency the Agreement is +copyrighted and may only be modified in the following manner. The Agreement +Steward reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement Steward has +the right to modify this Agreement. The Eclipse Foundation is the initial +Agreement Steward. The Eclipse Foundation may assign the responsibility to +serve as the Agreement Steward to a suitable separate entity. Each new version +of the Agreement will be given a distinguishing version number. The Program +(including Contributions) may always be distributed subject to the version of +the Agreement under which it was received. In addition, after a new version of +the Agreement is published, Contributor may elect to distribute the Program +(including its Contributions) under the new version. Except as expressly stated +in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to +the intellectual property of any Contributor under this Agreement, whether +expressly, by implication, estoppel or otherwise. All rights in the Program not +expressly granted under this Agreement are reserved.</span> </p> + +<p><span style="font-size: 10pt;">This Agreement is governed by the laws of the +State of New York and the intellectual property laws of the United States of +America. No party to this Agreement will bring a legal action under this +Agreement more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation.</span> </p> + +<p class="MsoNormal"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></p> + +</div> + +</body></html>
\ No newline at end of file diff --git a/plugins/org.gastro.rcp.table/icons/add.gif b/plugins/org.gastro.rcp.table/icons/add.gif Binary files differnew file mode 100644 index 0000000000..252d7ebcb8 --- /dev/null +++ b/plugins/org.gastro.rcp.table/icons/add.gif diff --git a/plugins/org.gastro.rcp.table/icons/alt_window_16.gif b/plugins/org.gastro.rcp.table/icons/alt_window_16.gif Binary files differnew file mode 100644 index 0000000000..05626b17d8 --- /dev/null +++ b/plugins/org.gastro.rcp.table/icons/alt_window_16.gif diff --git a/plugins/org.gastro.rcp.table/icons/alt_window_32.gif b/plugins/org.gastro.rcp.table/icons/alt_window_32.gif Binary files differnew file mode 100644 index 0000000000..b432f88339 --- /dev/null +++ b/plugins/org.gastro.rcp.table/icons/alt_window_32.gif diff --git a/plugins/org.gastro.rcp.table/icons/cancel.png b/plugins/org.gastro.rcp.table/icons/cancel.png Binary files differnew file mode 100644 index 0000000000..8f47c56f1f --- /dev/null +++ b/plugins/org.gastro.rcp.table/icons/cancel.png diff --git a/plugins/org.gastro.rcp.table/icons/delete.gif b/plugins/org.gastro.rcp.table/icons/delete.gif Binary files differnew file mode 100644 index 0000000000..b6922ac11c --- /dev/null +++ b/plugins/org.gastro.rcp.table/icons/delete.gif diff --git a/plugins/org.gastro.rcp.table/icons/down.png b/plugins/org.gastro.rcp.table/icons/down.png Binary files differnew file mode 100644 index 0000000000..9a2e36c09d --- /dev/null +++ b/plugins/org.gastro.rcp.table/icons/down.png diff --git a/plugins/org.gastro.rcp.table/icons/menucard.png b/plugins/org.gastro.rcp.table/icons/menucard.png Binary files differnew file mode 100644 index 0000000000..a81523bd60 --- /dev/null +++ b/plugins/org.gastro.rcp.table/icons/menucard.png diff --git a/plugins/org.gastro.rcp.table/icons/order.png b/plugins/org.gastro.rcp.table/icons/order.png Binary files differnew file mode 100644 index 0000000000..78a164736a --- /dev/null +++ b/plugins/org.gastro.rcp.table/icons/order.png diff --git a/plugins/org.gastro.rcp.table/icons/payment.png b/plugins/org.gastro.rcp.table/icons/payment.png Binary files differnew file mode 100644 index 0000000000..2880fca9a6 --- /dev/null +++ b/plugins/org.gastro.rcp.table/icons/payment.png diff --git a/plugins/org.gastro.rcp.table/icons/send.png b/plugins/org.gastro.rcp.table/icons/send.png Binary files differnew file mode 100644 index 0000000000..809824625f --- /dev/null +++ b/plugins/org.gastro.rcp.table/icons/send.png diff --git a/plugins/org.gastro.rcp.table/icons/service.png b/plugins/org.gastro.rcp.table/icons/service.png Binary files differnew file mode 100644 index 0000000000..d2b8073c76 --- /dev/null +++ b/plugins/org.gastro.rcp.table/icons/service.png diff --git a/plugins/org.gastro.rcp.table/icons/up.png b/plugins/org.gastro.rcp.table/icons/up.png Binary files differnew file mode 100644 index 0000000000..96960bf2de --- /dev/null +++ b/plugins/org.gastro.rcp.table/icons/up.png diff --git a/plugins/org.gastro.rcp.table/images/meal-1.png b/plugins/org.gastro.rcp.table/images/meal-1.png Binary files differnew file mode 100644 index 0000000000..7d6ab23c11 --- /dev/null +++ b/plugins/org.gastro.rcp.table/images/meal-1.png diff --git a/plugins/org.gastro.rcp.table/images/meal-2.png b/plugins/org.gastro.rcp.table/images/meal-2.png Binary files differnew file mode 100644 index 0000000000..783f6275f4 --- /dev/null +++ b/plugins/org.gastro.rcp.table/images/meal-2.png diff --git a/plugins/org.gastro.rcp.table/images/meal-3.png b/plugins/org.gastro.rcp.table/images/meal-3.png Binary files differnew file mode 100644 index 0000000000..537a8b494f --- /dev/null +++ b/plugins/org.gastro.rcp.table/images/meal-3.png diff --git a/plugins/org.gastro.rcp.table/images/meal-4.png b/plugins/org.gastro.rcp.table/images/meal-4.png Binary files differnew file mode 100644 index 0000000000..a1f5f7fcf9 --- /dev/null +++ b/plugins/org.gastro.rcp.table/images/meal-4.png diff --git a/plugins/org.gastro.rcp.table/images/meal-5.png b/plugins/org.gastro.rcp.table/images/meal-5.png Binary files differnew file mode 100644 index 0000000000..83e7fab3b2 --- /dev/null +++ b/plugins/org.gastro.rcp.table/images/meal-5.png diff --git a/plugins/org.gastro.rcp.table/license.html b/plugins/org.gastro.rcp.table/license.html new file mode 100644 index 0000000000..d7b88e9416 --- /dev/null +++ b/plugins/org.gastro.rcp.table/license.html @@ -0,0 +1,319 @@ +<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head> +<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> +<meta name="ProgId" content="Word.Document"> +<meta name="Generator" content="Microsoft Word 9"> +<meta name="Originator" content="Microsoft Word 9"> +<link rel="File-List" href="http://www.eclipse.org/org/documents/Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml"><title>Eclipse Public License - Version 1.0</title><!--[if gte mso 9]><xml> + <o:DocumentProperties> + <o:Revision>2</o:Revision> + <o:TotalTime>3</o:TotalTime> + <o:Created>2004-03-05T23:03:00Z</o:Created> + <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved> + <o:Pages>4</o:Pages> + <o:Words>1626</o:Words> + <o:Characters>9270</o:Characters> + <o:Lines>77</o:Lines> + <o:Paragraphs>18</o:Paragraphs> + <o:CharactersWithSpaces>11384</o:CharactersWithSpaces> + <o:Version>9.4402</o:Version> + </o:DocumentProperties> +</xml><![endif]--><!--[if gte mso 9]><xml> + <w:WordDocument> + <w:TrackRevisions/> + </w:WordDocument> +</xml><![endif]--> + + +<style> +<!-- + /* Font Definitions */ +@font-face + {font-family:Tahoma; + panose-1:2 11 6 4 3 5 4 4 2 4; + mso-font-charset:0; + mso-generic-font-family:swiss; + mso-font-pitch:variable; + mso-font-signature:553679495 -2147483648 8 0 66047 0;} + /* Style Definitions */ +p.MsoNormal, li.MsoNormal, div.MsoNormal + {mso-style-parent:""; + margin:0in; + margin-bottom:.0001pt; + mso-pagination:widow-orphan; + font-size:12.0pt; + font-family:"Times New Roman"; + mso-fareast-font-family:"Times New Roman";} +p + {margin-right:0in; + mso-margin-top-alt:auto; + mso-margin-bottom-alt:auto; + margin-left:0in; + mso-pagination:widow-orphan; + font-size:12.0pt; + font-family:"Times New Roman"; + mso-fareast-font-family:"Times New Roman";} +p.BalloonText, li.BalloonText, div.BalloonText + {mso-style-name:"Balloon Text"; + margin:0in; + margin-bottom:.0001pt; + mso-pagination:widow-orphan; + font-size:8.0pt; + font-family:Tahoma; + mso-fareast-font-family:"Times New Roman";} +@page Section1 + {size:8.5in 11.0in; + margin:1.0in 1.25in 1.0in 1.25in; + mso-header-margin:.5in; + mso-footer-margin:.5in; + mso-paper-source:0;} +div.Section1 + {page:Section1;} +--> +</style></head> + +<body style="" lang="EN-US"> + +<div class="Section1"> + +<p style="text-align: center;" align="center"><b>Eclipse Public License - v 1.0</b> +</p> + +<p><span style="font-size: 10pt;">THE ACCOMPANYING PROGRAM IS PROVIDED UNDER +THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, +REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE +OF THIS AGREEMENT.</span> </p> + +<p><b><span style="font-size: 10pt;">1. DEFINITIONS</span></b> </p> + +<p><span style="font-size: 10pt;">"Contribution" means:</span> </p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a) +in the case of the initial Contributor, the initial code and documentation +distributed under this Agreement, and<br clear="left"> +b) in the case of each subsequent Contributor:</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">i) +changes to the Program, and</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">ii) +additions to the Program;</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">where +such changes and/or additions to the Program originate from and are distributed +by that particular Contributor. A Contribution 'originates' from a Contributor +if it was added to the Program by such Contributor itself or anyone acting on +such Contributor's behalf. Contributions do not include additions to the +Program which: (i) are separate modules of software distributed in conjunction +with the Program under their own license agreement, and (ii) are not derivative +works of the Program. </span></p> + +<p><span style="font-size: 10pt;">"Contributor" means any person or +entity that distributes the Program.</span> </p> + +<p><span style="font-size: 10pt;">"Licensed Patents " mean patent +claims licensable by a Contributor which are necessarily infringed by the use +or sale of its Contribution alone or when combined with the Program. </span></p> + +<p><span style="font-size: 10pt;">"Program" means the Contributions +distributed in accordance with this Agreement.</span> </p> + +<p><span style="font-size: 10pt;">"Recipient" means anyone who +receives the Program under this Agreement, including all Contributors.</span> </p> + +<p><b><span style="font-size: 10pt;">2. GRANT OF RIGHTS</span></b> </p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a) +Subject to the terms of this Agreement, each Contributor hereby grants Recipient +a non-exclusive, worldwide, royalty-free copyright license to<span style="color: red;"> </span>reproduce, prepare derivative works of, publicly +display, publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and object code +form.</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b) +Subject to the terms of this Agreement, each Contributor hereby grants +Recipient a non-exclusive, worldwide,<span style="color: green;"> </span>royalty-free +patent license under Licensed Patents to make, use, sell, offer to sell, import +and otherwise transfer the Contribution of such Contributor, if any, in source +code and object code form. This patent license shall apply to the combination +of the Contribution and the Program if, at the time the Contribution is added +by the Contributor, such addition of the Contribution causes such combination +to be covered by the Licensed Patents. The patent license shall not apply to +any other combinations which include the Contribution. No hardware per se is +licensed hereunder. </span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">c) +Recipient understands that although each Contributor grants the licenses to its +Contributions set forth herein, no assurances are provided by any Contributor +that the Program does not infringe the patent or other intellectual property +rights of any other entity. Each Contributor disclaims any liability to Recipient +for claims brought by any other entity based on infringement of intellectual +property rights or otherwise. As a condition to exercising the rights and +licenses granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For example, +if a third party patent license is required to allow Recipient to distribute +the Program, it is Recipient's responsibility to acquire that license before +distributing the Program.</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">d) +Each Contributor represents that to its knowledge it has sufficient copyright +rights in its Contribution, if any, to grant the copyright license set forth in +this Agreement. </span></p> + +<p><b><span style="font-size: 10pt;">3. REQUIREMENTS</span></b> </p> + +<p><span style="font-size: 10pt;">A Contributor may choose to distribute the +Program in object code form under its own license agreement, provided that:</span> +</p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a) +it complies with the terms and conditions of this Agreement; and</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b) +its license agreement:</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">i) +effectively disclaims on behalf of all Contributors all warranties and +conditions, express and implied, including warranties or conditions of title +and non-infringement, and implied warranties or conditions of merchantability +and fitness for a particular purpose; </span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">ii) +effectively excludes on behalf of all Contributors all liability for damages, +including direct, indirect, special, incidental and consequential damages, such +as lost profits; </span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">iii) +states that any provisions which differ from this Agreement are offered by that +Contributor alone and not by any other party; and</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">iv) +states that source code for the Program is available from such Contributor, and +informs licensees how to obtain it in a reasonable manner on or through a +medium customarily used for software exchange.<span style="color: blue;"> </span></span></p> + +<p><span style="font-size: 10pt;">When the Program is made available in source +code form:</span> </p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a) +it must be made available under this Agreement; and </span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b) a +copy of this Agreement must be included with each copy of the Program. </span></p> + +<p><span style="font-size: 10pt;">Contributors may not remove or alter any +copyright notices contained within the Program. </span></p> + +<p><span style="font-size: 10pt;">Each Contributor must identify itself as the +originator of its Contribution, if any, in a manner that reasonably allows +subsequent Recipients to identify the originator of the Contribution. </span></p> + +<p><b><span style="font-size: 10pt;">4. COMMERCIAL DISTRIBUTION</span></b> </p> + +<p><span style="font-size: 10pt;">Commercial distributors of software may +accept certain responsibilities with respect to end users, business partners +and the like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a commercial +product offering should do so in a manner which does not create potential +liability for other Contributors. Therefore, if a Contributor includes the +Program in a commercial product offering, such Contributor ("Commercial +Contributor") hereby agrees to defend and indemnify every other +Contributor ("Indemnified Contributor") against any losses, damages and +costs (collectively "Losses") arising from claims, lawsuits and other +legal actions brought by a third party against the Indemnified Contributor to +the extent caused by the acts or omissions of such Commercial Contributor in +connection with its distribution of the Program in a commercial product +offering. The obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. In order +to qualify, an Indemnified Contributor must: a) promptly notify the Commercial +Contributor in writing of such claim, and b) allow the Commercial Contributor +to control, and cooperate with the Commercial Contributor in, the defense and +any related settlement negotiations. The Indemnified Contributor may participate +in any such claim at its own expense.</span> </p> + +<p><span style="font-size: 10pt;">For example, a Contributor might include the +Program in a commercial product offering, Product X. That Contributor is then a +Commercial Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance claims and +warranties are such Commercial Contributor's responsibility alone. Under this +section, the Commercial Contributor would have to defend claims against the +other Contributors related to those performance claims and warranties, and if a +court requires any other Contributor to pay any damages as a result, the +Commercial Contributor must pay those damages.</span> </p> + +<p><b><span style="font-size: 10pt;">5. NO WARRANTY</span></b> </p> + +<p><span style="font-size: 10pt;">EXCEPT AS EXPRESSLY SET FORTH IN THIS +AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, +WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, +MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and distributing the +Program and assumes all risks associated with its exercise of rights under this +Agreement , including but not limited to the risks and costs of program errors, +compliance with applicable laws, damage to or loss of data, programs or +equipment, and unavailability or interruption of operations. </span></p> + +<p><b><span style="font-size: 10pt;">6. DISCLAIMER OF LIABILITY</span></b> </p> + +<p><span style="font-size: 10pt;">EXCEPT AS EXPRESSLY SET FORTH IN THIS +AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF +THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGES.</span> </p> + +<p><b><span style="font-size: 10pt;">7. GENERAL</span></b> </p> + +<p><span style="font-size: 10pt;">If any provision of this Agreement is invalid +or unenforceable under applicable law, it shall not affect the validity or +enforceability of the remainder of the terms of this Agreement, and without +further action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable.</span> </p> + +<p><span style="font-size: 10pt;">If Recipient institutes patent litigation +against any entity (including a cross-claim or counterclaim in a lawsuit) +alleging that the Program itself (excluding combinations of the Program with +other software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of the date +such litigation is filed. </span></p> + +<p><span style="font-size: 10pt;">All Recipient's rights under this Agreement +shall terminate if it fails to comply with any of the material terms or +conditions of this Agreement and does not cure such failure in a reasonable +period of time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use and +distribution of the Program as soon as reasonably practicable. However, +Recipient's obligations under this Agreement and any licenses granted by +Recipient relating to the Program shall continue and survive. </span></p> + +<p><span style="font-size: 10pt;">Everyone is permitted to copy and distribute +copies of this Agreement, but in order to avoid inconsistency the Agreement is +copyrighted and may only be modified in the following manner. The Agreement +Steward reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement Steward has +the right to modify this Agreement. The Eclipse Foundation is the initial +Agreement Steward. The Eclipse Foundation may assign the responsibility to +serve as the Agreement Steward to a suitable separate entity. Each new version +of the Agreement will be given a distinguishing version number. The Program +(including Contributions) may always be distributed subject to the version of +the Agreement under which it was received. In addition, after a new version of +the Agreement is published, Contributor may elect to distribute the Program +(including its Contributions) under the new version. Except as expressly stated +in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to +the intellectual property of any Contributor under this Agreement, whether +expressly, by implication, estoppel or otherwise. All rights in the Program not +expressly granted under this Agreement are reserved.</span> </p> + +<p><span style="font-size: 10pt;">This Agreement is governed by the laws of the +State of New York and the intellectual property laws of the United States of +America. No party to this Agreement will bring a legal action under this +Agreement more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation.</span> </p> + +<p class="MsoNormal"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></p> + +</div> + +</body></html>
\ No newline at end of file diff --git a/plugins/org.gastro.rcp.table/plugin.xml b/plugins/org.gastro.rcp.table/plugin.xml new file mode 100644 index 0000000000..733251c115 --- /dev/null +++ b/plugins/org.gastro.rcp.table/plugin.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + + <extension + point="org.eclipse.ui.perspectives"> + <perspective + name="Table Perspective" + class="org.gastro.rcp.internal.table.TablePerspective" + id="org.gastro.rcp.table.perspective"> + </perspective> + </extension> + + <extension + point="org.eclipse.ui.views"> + <view + name="Table View" + class="org.gastro.rcp.internal.table.TableView" + id="org.gastro.rcp.table.view"> + </view> + </extension> + +</plugin> diff --git a/plugins/org.gastro.rcp.table/src/com/swtdesigner/ResourceManager.java b/plugins/org.gastro.rcp.table/src/com/swtdesigner/ResourceManager.java new file mode 100644 index 0000000000..64be40314e --- /dev/null +++ b/plugins/org.gastro.rcp.table/src/com/swtdesigner/ResourceManager.java @@ -0,0 +1,494 @@ +package com.swtdesigner; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.resource.CompositeImageDescriptor; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +import org.osgi.framework.Bundle; + +import java.io.File; +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +/** + * Utility class for managing OS resources associated with SWT/JFace controls such as colors, fonts, images, etc. !!! + * IMPORTANT !!! Application code must explicitly invoke the <code>dispose()</code> method to release the operating + * system resources managed by cached objects when those objects and OS resources are no longer needed (e.g. on + * application shutdown) This class may be freely distributed as part of any application or plugin. + * <p> + * Copyright (c) 2003 - 2007, Instantiations, Inc. <br> + * All Rights Reserved + * + * @author scheglov_ke + * @author Dan Rubel + */ +@SuppressWarnings("unchecked") +public class ResourceManager extends SWTResourceManager +{ + // ////////////////////////////////////////////////////////////////////////// + // + // Image + // + // ////////////////////////////////////////////////////////////////////////// + private static Map/* <ImageDescriptor,Image> */m_descriptorImageMap = new HashMap(); + + /** + * Returns an {@link ImageDescriptor} stored in the file at the specified path relative to the specified class. + * + * @param clazz + * the {@link Class} relative to which to find the image descriptor. + * @param path + * the path to the image file. + * @return the {@link ImageDescriptor} stored in the file at the specified path. + */ + public static ImageDescriptor getImageDescriptor(Class clazz, String path) + { + return ImageDescriptor.createFromFile(clazz, path); + } + + /** + * Returns an {@link ImageDescriptor} stored in the file at the specified path. + * + * @param path + * the path to the image file. + * @return the {@link ImageDescriptor} stored in the file at the specified path. + */ + public static ImageDescriptor getImageDescriptor(String path) + { + try + { + return ImageDescriptor.createFromURL((new File(path)).toURL()); + } + catch (MalformedURLException e) + { + return null; + } + } + + /** + * Returns an {@link Image} based on the specified {@link ImageDescriptor}. + * + * @param descriptor + * the {@link ImageDescriptor} for the {@link Image}. + * @return the {@link Image} based on the specified {@link ImageDescriptor}. + */ + public static Image getImage(ImageDescriptor descriptor) + { + if (descriptor == null) + { + return null; + } + Image image = (Image)m_descriptorImageMap.get(descriptor); + if (image == null) + { + image = descriptor.createImage(); + m_descriptorImageMap.put(descriptor, image); + } + return image; + } + + /** + * Maps images to decorated images. + */ + private static Map[]/* <Image,Map<Image,Image>> */m_decoratedImageMap = new Map[LAST_CORNER_KEY]; + + /** + * Returns an {@link Image} composed of a base image decorated by another image. + * + * @param baseImage + * the base {@link Image} that should be decorated. + * @param decorator + * the {@link Image} to decorate the base image. + * @return {@link Image} The resulting decorated image. + */ + public static Image decorateImage(Image baseImage, Image decorator) + { + return decorateImage(baseImage, decorator, BOTTOM_RIGHT); + } + + /** + * Returns an {@link Image} composed of a base image decorated by another image. + * + * @param baseImage + * the base {@link Image} that should be decorated. + * @param decorator + * the {@link Image} to decorate the base image. + * @param corner + * the corner to place decorator image. + * @return the resulting decorated {@link Image}. + */ + public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) + { + if (corner <= 0 || corner >= LAST_CORNER_KEY) + { + throw new IllegalArgumentException("Wrong decorate corner"); + } + Map cornerDecoratedImageMap = m_decoratedImageMap[corner]; + if (cornerDecoratedImageMap == null) + { + cornerDecoratedImageMap = new HashMap(); + m_decoratedImageMap[corner] = cornerDecoratedImageMap; + } + Map decoratedMap = (Map)cornerDecoratedImageMap.get(baseImage); + if (decoratedMap == null) + { + decoratedMap = new HashMap(); + cornerDecoratedImageMap.put(baseImage, decoratedMap); + } + // + Image result = (Image)decoratedMap.get(decorator); + if (result == null) + { + final Rectangle bib = baseImage.getBounds(); + final Rectangle dib = decorator.getBounds(); + final Point baseImageSize = new Point(bib.width, bib.height); + CompositeImageDescriptor compositImageDesc = new CompositeImageDescriptor() + { + protected void drawCompositeImage(int width, int height) + { + drawImage(baseImage.getImageData(), 0, 0); + if (corner == TOP_LEFT) + { + drawImage(decorator.getImageData(), 0, 0); + } + else if (corner == TOP_RIGHT) + { + drawImage(decorator.getImageData(), bib.width - dib.width, 0); + } + else if (corner == BOTTOM_LEFT) + { + drawImage(decorator.getImageData(), 0, bib.height - dib.height); + } + else if (corner == BOTTOM_RIGHT) + { + drawImage(decorator.getImageData(), bib.width - dib.width, bib.height - dib.height); + } + } + + protected Point getSize() + { + return baseImageSize; + } + }; + // + result = compositImageDesc.createImage(); + decoratedMap.put(decorator, result); + } + return result; + } + + /** + * Dispose all of the cached images. + */ + public static void disposeImages() + { + SWTResourceManager.disposeImages(); + // dispose ImageDescriptor images + { + for (Iterator I = m_descriptorImageMap.values().iterator(); I.hasNext();) + { + ((Image)I.next()).dispose(); + } + m_descriptorImageMap.clear(); + } + // dispose decorated images + for (int i = 0; i < m_decoratedImageMap.length; i++) + { + Map cornerDecoratedImageMap = m_decoratedImageMap[i]; + if (cornerDecoratedImageMap != null) + { + for (Iterator I = cornerDecoratedImageMap.values().iterator(); I.hasNext();) + { + Map decoratedMap = (Map)I.next(); + for (Iterator J = decoratedMap.values().iterator(); J.hasNext();) + { + Image image = (Image)J.next(); + image.dispose(); + } + decoratedMap.clear(); + } + cornerDecoratedImageMap.clear(); + } + } + // dispose plugin images + { + for (Iterator I = m_URLImageMap.values().iterator(); I.hasNext();) + { + ((Image)I.next()).dispose(); + } + m_URLImageMap.clear(); + } + } + + // ////////////////////////////////////////////////////////////////////////// + // + // Plugin images support + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Maps URL to images. + */ + private static Map/* <URL,Image> */m_URLImageMap = new HashMap(); + + /** + * Provider for plugin resources, used by WindowBuilder at design time. + */ + public interface PluginResourceProvider + { + URL getEntry(String symbolicName, String path); + } + + /** + * Instance of {@link PluginResourceProvider}, used by WindowBuilder at design time. + */ + private static PluginResourceProvider m_designTimePluginResourceProvider = null; + + /** + * Returns an {@link Image} based on a plugin and file path. + * + * @param plugin + * the plugin {@link Object} containing the image + * @param name + * the path to the image within the plugin + * @return the {@link Image} stored in the file at the specified path + * @deprecated Use {@link #getPluginImage(String, String)} instead. + */ + public static Image getPluginImage(Object plugin, String name) + { + try + { + URL url = getPluginImageURL(plugin, name); + if (url != null) + { + return getPluginImageFromUrl(url); + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + return null; + } + + /** + * Returns an {@link Image} based on a {@link Bundle} and resource entry path. + * + * @param symbolicName + * the symbolic name of the {@link Bundle}. + * @param path + * the path of the resource entry. + * @return the {@link Image} stored in the file at the specified path. + */ + public static Image getPluginImage(String symbolicName, String path) + { + try + { + URL url = getPluginImageURL(symbolicName, path); + if (url != null) + { + return getPluginImageFromUrl(url); + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + return null; + } + + /** + * Returns an {@link Image} based on given {@link URL}. + */ + private static Image getPluginImageFromUrl(URL url) + { + try + { + try + { + if (m_URLImageMap.containsKey(url)) + { + return (Image)m_URLImageMap.get(url); + } + InputStream stream = url.openStream(); + Image image; + try + { + image = getImage(stream); + m_URLImageMap.put(url, image); + } + finally + { + stream.close(); + } + return image; + } + catch (Throwable e) + { + // Ignore any exceptions + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + return null; + } + + /** + * Returns an {@link ImageDescriptor} based on a plugin and file path. + * + * @param plugin + * the plugin {@link Object} containing the image. + * @param name + * the path to th eimage within the plugin. + * @return the {@link ImageDescriptor} stored in the file at the specified path. + * @deprecated Use {@link #getPluginImageDescriptor(String, String)} instead. + */ + public static ImageDescriptor getPluginImageDescriptor(Object plugin, String name) + { + try + { + try + { + URL url = getPluginImageURL(plugin, name); + return ImageDescriptor.createFromURL(url); + } + catch (Throwable e) + { + // Ignore any exceptions + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + return null; + } + + /** + * Returns an {@link ImageDescriptor} based on a {@link Bundle} and resource entry path. + * + * @param symbolicName + * the symbolic name of the {@link Bundle}. + * @param path + * the path of the resource entry. + * @return the {@link ImageDescriptor} based on a {@link Bundle} and resource entry path. + */ + public static ImageDescriptor getPluginImageDescriptor(String symbolicName, String path) + { + try + { + URL url = getPluginImageURL(symbolicName, path); + if (url != null) + { + return ImageDescriptor.createFromURL(url); + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + return null; + } + + /** + * Returns an {@link URL} based on a {@link Bundle} and resource entry path. + */ + private static URL getPluginImageURL(String symbolicName, String path) + { + // try runtime plugins + { + Bundle bundle = Platform.getBundle(symbolicName); + if (bundle != null) + { + return bundle.getEntry(path); + } + } + // try design time provider + if (m_designTimePluginResourceProvider != null) + { + return m_designTimePluginResourceProvider.getEntry(symbolicName, path); + } + // no such resource + return null; + } + + /** + * Returns an {@link URL} based on a plugin and file path. + * + * @param plugin + * the plugin {@link Object} containing the file path. + * @param name + * the file path. + * @return the {@link URL} representing the file at the specified path. + * @throws Exception + */ + private static URL getPluginImageURL(Object plugin, String name) throws Exception + { + // try to work with 'plugin' as with OSGI BundleContext + try + { + Class BundleClass = Class.forName("org.osgi.framework.Bundle"); //$NON-NLS-1$ + Class BundleContextClass = Class.forName("org.osgi.framework.BundleContext"); //$NON-NLS-1$ + if (BundleContextClass.isAssignableFrom(plugin.getClass())) + { + Method getBundleMethod = BundleContextClass.getMethod("getBundle", new Class[0]); //$NON-NLS-1$ + Object bundle = getBundleMethod.invoke(plugin, new Object[0]); + // + Class PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$ + Constructor pathConstructor = PathClass.getConstructor(new Class[] { String.class }); + Object path = pathConstructor.newInstance(new Object[] { name }); + // + Class IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$ + Class PlatformClass = Class.forName("org.eclipse.core.runtime.Platform"); //$NON-NLS-1$ + Method findMethod = PlatformClass.getMethod("find", new Class[] { BundleClass, IPathClass }); //$NON-NLS-1$ + return (URL)findMethod.invoke(null, new Object[] { bundle, path }); + } + } + catch (Throwable e) + { + // Ignore any exceptions + } + // else work with 'plugin' as with usual Eclipse plugin + { + Class PluginClass = Class.forName("org.eclipse.core.runtime.Plugin"); //$NON-NLS-1$ + if (PluginClass.isAssignableFrom(plugin.getClass())) + { + // + Class PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$ + Constructor pathConstructor = PathClass.getConstructor(new Class[] { String.class }); + Object path = pathConstructor.newInstance(new Object[] { name }); + // + Class IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$ + Method findMethod = PluginClass.getMethod("find", new Class[] { IPathClass }); //$NON-NLS-1$ + return (URL)findMethod.invoke(plugin, new Object[] { path }); + } + } + return null; + } + + // ////////////////////////////////////////////////////////////////////////// + // + // General + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Dispose of cached objects and their underlying OS resources. This should only be called when the cached objects are + * no longer needed (e.g. on application shutdown). + */ + public static void dispose() + { + disposeColors(); + disposeFonts(); + disposeImages(); + } +} diff --git a/plugins/org.gastro.rcp.table/src/com/swtdesigner/SWTResourceManager.java b/plugins/org.gastro.rcp.table/src/com/swtdesigner/SWTResourceManager.java new file mode 100644 index 0000000000..682220565f --- /dev/null +++ b/plugins/org.gastro.rcp.table/src/com/swtdesigner/SWTResourceManager.java @@ -0,0 +1,491 @@ +package com.swtdesigner; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Display; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +/** + * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc. + * <p> + * !!! IMPORTANT !!! Application code must explicitly invoke the <code>dispose()</code> method to release the operating + * system resources managed by cached objects when those objects and OS resources are no longer needed (e.g. on + * application shutdown) + * <p> + * This class may be freely distributed as part of any application or plugin. + * <p> + * Copyright (c) 2003 - 2007, Instantiations, Inc. <br> + * All Rights Reserved + * + * @author scheglov_ke + * @author Dan Rubel + */ +@SuppressWarnings("unchecked") +public class SWTResourceManager +{ + // ////////////////////////////////////////////////////////////////////////// + // + // Color + // + // ////////////////////////////////////////////////////////////////////////// + private static Map/* <RGB,Color> */m_colorMap = new HashMap(); + + /** + * Returns the system {@link Color} matching the specific ID. + * + * @param systemColorID + * the ID value for the color + * @return the system {@link Color} matching the specific ID + */ + public static Color getColor(int systemColorID) + { + Display display = Display.getCurrent(); + return display.getSystemColor(systemColorID); + } + + /** + * Returns a {@link Color} given its red, green and blue component values. + * + * @param r + * the red component of the color + * @param g + * the green component of the color + * @param b + * the blue component of the color + * @return the {@link Color} matching the given red, green and blue component values + */ + public static Color getColor(int r, int g, int b) + { + return getColor(new RGB(r, g, b)); + } + + /** + * Returns a {@link Color} given its RGB value. + * + * @param rgb + * the {@link RGB} value of the color + * @return the {@link Color} matching the RGB value + */ + public static Color getColor(RGB rgb) + { + Color color = (Color)m_colorMap.get(rgb); + if (color == null) + { + Display display = Display.getCurrent(); + color = new Color(display, rgb); + m_colorMap.put(rgb, color); + } + return color; + } + + /** + * Dispose of all the cached {@link Color}'s. + */ + public static void disposeColors() + { + for (Iterator I = m_colorMap.values().iterator(); I.hasNext();) + { + ((Color)I.next()).dispose(); + } + m_colorMap.clear(); + } + + // ////////////////////////////////////////////////////////////////////////// + // + // Image + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Maps image paths to images. + */ + private static Map/* <String,Image> */m_imageMap = new HashMap(); + + /** + * Returns an {@link Image} encoded by the specified {@link InputStream}. + * + * @param stream + * the {@link InputStream} encoding the image data + * @return the {@link Image} encoded by the specified input stream + */ + protected static Image getImage(InputStream stream) throws IOException + { + try + { + Display display = Display.getCurrent(); + ImageData data = new ImageData(stream); + if (data.transparentPixel > 0) + { + return new Image(display, data, data.getTransparencyMask()); + } + return new Image(display, data); + } + finally + { + stream.close(); + } + } + + /** + * Returns an {@link Image} stored in the file at the specified path. + * + * @param path + * the path to the image file + * @return the {@link Image} stored in the file at the specified path + */ + public static Image getImage(String path) + { + Image image = (Image)m_imageMap.get(path); + if (image == null) + { + try + { + image = getImage(new FileInputStream(path)); + m_imageMap.put(path, image); + } + catch (Exception e) + { + image = getMissingImage(); + m_imageMap.put(path, image); + } + } + return image; + } + + /** + * Returns an {@link Image} stored in the file at the specified path relative to the specified class. + * + * @param clazz + * the {@link Class} relative to which to find the image + * @param path + * the path to the image file, if starts with <code>'/'</code> + * @return the {@link Image} stored in the file at the specified path + */ + public static Image getImage(Class clazz, String path) + { + String key = clazz.getName() + '|' + path; + Image image = (Image)m_imageMap.get(key); + if (image == null) + { + try + { + image = getImage(clazz.getResourceAsStream(path)); + m_imageMap.put(key, image); + } + catch (Exception e) + { + image = getMissingImage(); + m_imageMap.put(key, image); + } + } + return image; + } + + private static final int MISSING_IMAGE_SIZE = 10; + + /** + * @return the small {@link Image} that can be used as placeholder for missing image. + */ + private static Image getMissingImage() + { + Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); + // + GC gc = new GC(image); + gc.setBackground(getColor(SWT.COLOR_RED)); + gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); + gc.dispose(); + // + return image; + } + + /** + * Style constant for placing decorator image in top left corner of base image. + */ + public static final int TOP_LEFT = 1; + + /** + * Style constant for placing decorator image in top right corner of base image. + */ + public static final int TOP_RIGHT = 2; + + /** + * Style constant for placing decorator image in bottom left corner of base image. + */ + public static final int BOTTOM_LEFT = 3; + + /** + * Style constant for placing decorator image in bottom right corner of base image. + */ + public static final int BOTTOM_RIGHT = 4; + + /** + * Internal value. + */ + protected static final int LAST_CORNER_KEY = 5; + + /** + * Maps images to decorated images. + */ + private static Map[]/* <Image,Map<Image,Image>> */m_decoratedImageMap = new Map[LAST_CORNER_KEY]; + + /** + * Returns an {@link Image} composed of a base image decorated by another image. + * + * @param baseImage + * the base {@link Image} that should be decorated + * @param decorator + * the {@link Image} to decorate the base image + * @return {@link Image} The resulting decorated image + */ + public static Image decorateImage(Image baseImage, Image decorator) + { + return decorateImage(baseImage, decorator, BOTTOM_RIGHT); + } + + /** + * Returns an {@link Image} composed of a base image decorated by another image. + * + * @param baseImage + * the base {@link Image} that should be decorated + * @param decorator + * the {@link Image} to decorate the base image + * @param corner + * the corner to place decorator image + * @return the resulting decorated {@link Image} + */ + public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) + { + if (corner <= 0 || corner >= LAST_CORNER_KEY) + { + throw new IllegalArgumentException("Wrong decorate corner"); + } + Map cornerDecoratedImageMap = m_decoratedImageMap[corner]; + if (cornerDecoratedImageMap == null) + { + cornerDecoratedImageMap = new HashMap(); + m_decoratedImageMap[corner] = cornerDecoratedImageMap; + } + Map decoratedMap = (Map)cornerDecoratedImageMap.get(baseImage); + if (decoratedMap == null) + { + decoratedMap = new HashMap(); + cornerDecoratedImageMap.put(baseImage, decoratedMap); + } + // + Image result = (Image)decoratedMap.get(decorator); + if (result == null) + { + Rectangle bib = baseImage.getBounds(); + Rectangle dib = decorator.getBounds(); + // + result = new Image(Display.getCurrent(), bib.width, bib.height); + // + GC gc = new GC(result); + gc.drawImage(baseImage, 0, 0); + if (corner == TOP_LEFT) + { + gc.drawImage(decorator, 0, 0); + } + else if (corner == TOP_RIGHT) + { + gc.drawImage(decorator, bib.width - dib.width, 0); + } + else if (corner == BOTTOM_LEFT) + { + gc.drawImage(decorator, 0, bib.height - dib.height); + } + else if (corner == BOTTOM_RIGHT) + { + gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height); + } + gc.dispose(); + // + decoratedMap.put(decorator, result); + } + return result; + } + + /** + * Dispose all of the cached {@link Image}'s. + */ + public static void disposeImages() + { + // dispose loaded images + { + for (Iterator I = m_imageMap.values().iterator(); I.hasNext();) + { + ((Image)I.next()).dispose(); + } + m_imageMap.clear(); + } + // dispose decorated images + for (int i = 0; i < m_decoratedImageMap.length; i++) + { + Map cornerDecoratedImageMap = m_decoratedImageMap[i]; + if (cornerDecoratedImageMap != null) + { + for (Iterator I = cornerDecoratedImageMap.values().iterator(); I.hasNext();) + { + Map decoratedMap = (Map)I.next(); + for (Iterator J = decoratedMap.values().iterator(); J.hasNext();) + { + Image image = (Image)J.next(); + image.dispose(); + } + decoratedMap.clear(); + } + cornerDecoratedImageMap.clear(); + } + } + } + + // ////////////////////////////////////////////////////////////////////////// + // + // Font + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Maps font names to fonts. + */ + private static Map/* <String,Font> */m_fontMap = new HashMap(); + + /** + * Maps fonts to their bold versions. + */ + private static Map/* <Font,Font> */m_fontToBoldFontMap = new HashMap(); + + /** + * Returns a {@link Font} based on its name, height and style. + * + * @param name + * the name of the font + * @param height + * the height of the font + * @param style + * the style of the font + * @return {@link Font} The font matching the name, height and style + */ + public static Font getFont(String name, int height, int style) + { + return getFont(name, height, style, false, false); + } + + /** + * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline flags are also + * supported. + * + * @param name + * the name of the font + * @param size + * the size of the font + * @param style + * the style of the font + * @param strikeout + * the strikeout flag (warning: Windows only) + * @param underline + * the underline flag (warning: Windows only) + * @return {@link Font} The font matching the name, height, style, strikeout and underline + */ + public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) + { + String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline; + Font font = (Font)m_fontMap.get(fontName); + if (font == null) + { + FontData fontData = new FontData(name, size, style); + if (strikeout || underline) + { + try + { + Class logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$ + Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$ + if (logFont != null && logFontClass != null) + { + if (strikeout) + { + logFontClass.getField("lfStrikeOut").set(logFont, new Byte((byte)1)); //$NON-NLS-1$ + } + if (underline) + { + logFontClass.getField("lfUnderline").set(logFont, new Byte((byte)1)); //$NON-NLS-1$ + } + } + } + catch (Throwable e) + { + System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + font = new Font(Display.getCurrent(), fontData); + m_fontMap.put(fontName, font); + } + return font; + } + + /** + * Returns a bold version of the given {@link Font}. + * + * @param baseFont + * the {@link Font} for which a bold version is desired + * @return the bold version of the given {@link Font} + */ + public static Font getBoldFont(Font baseFont) + { + Font font = (Font)m_fontToBoldFontMap.get(baseFont); + if (font == null) + { + FontData fontDatas[] = baseFont.getFontData(); + FontData data = fontDatas[0]; + font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD); + m_fontToBoldFontMap.put(baseFont, font); + } + return font; + } + + /** + * Dispose all of the cached {@link Font}'s. + */ + public static void disposeFonts() + { + // clear fonts + for (Iterator iter = m_fontMap.values().iterator(); iter.hasNext();) + { + ((Font)iter.next()).dispose(); + } + m_fontMap.clear(); + // clear bold fonts + for (Iterator iter = m_fontToBoldFontMap.values().iterator(); iter.hasNext();) + { + ((Font)iter.next()).dispose(); + } + m_fontToBoldFontMap.clear(); + } + + // ////////////////////////////////////////////////////////////////////////// + // + // General + // + // ////////////////////////////////////////////////////////////////////////// + /** + * Dispose of cached objects and their underlying OS resources. This should only be called when the cached objects are + * no longer needed (e.g. on application shutdown). + */ + public static void dispose() + { + disposeColors(); + disposeImages(); + disposeFonts(); + } +} diff --git a/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/Activator.java b/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/Activator.java new file mode 100644 index 0000000000..0911ac0ed8 --- /dev/null +++ b/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/Activator.java @@ -0,0 +1,84 @@ +/** + * Copyright (c) 2009 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + * + * Initial Publication: + * Eclipse Magazin - http://www.eclipse-magazin.de + */ +package org.gastro.rcp.internal.table; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +import com.swtdesigner.ResourceManager; + +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin +{ + + // The plug-in ID + public static final String PLUGIN_ID = "org.gastro.rcp.table"; + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() + { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception + { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception + { + ResourceManager.dispose(); + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() + { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given plug-in relative path + * + * @param path + * the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) + { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/TablePerspective.java b/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/TablePerspective.java new file mode 100644 index 0000000000..a1f92aa3f0 --- /dev/null +++ b/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/TablePerspective.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2009 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + * + * Initial Publication: + * Eclipse Magazin - http://www.eclipse-magazin.de + */ +package org.gastro.rcp.internal.table; + +import org.eclipse.ui.IPageLayout; +import org.eclipse.ui.IPerspectiveFactory; + +public class TablePerspective implements IPerspectiveFactory +{ + public void createInitialLayout(IPageLayout layout) + { + String editorArea = layout.getEditorArea(); + layout.setEditorAreaVisible(false); + layout.setFixed(true); + layout.addStandaloneView(TableView.ID, false, IPageLayout.LEFT, 1.0f, editorArea); + } +} diff --git a/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/TableView.java b/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/TableView.java new file mode 100644 index 0000000000..0dc021f593 --- /dev/null +++ b/plugins/org.gastro.rcp.table/src/org/gastro/rcp/internal/table/TableView.java @@ -0,0 +1,769 @@ +/** + * Copyright (c) 2009 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + * + * Initial Publication: + * Eclipse Magazin - http://www.eclipse-magazin.de + */ +package org.gastro.rcp.internal.table; + +import org.eclipse.net4j.util.StringUtil; +import org.eclipse.net4j.util.ref.ReferenceValueMap; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; +import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; + +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.nebula.widgets.pshelf.PShelf; +import org.eclipse.nebula.widgets.pshelf.PShelfItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.ui.part.ViewPart; + +import com.swtdesigner.ResourceManager; +import com.swtdesigner.SWTResourceManager; + +import org.gastro.business.BusinessDay; +import org.gastro.business.BusinessFactory; +import org.gastro.business.Order; +import org.gastro.business.OrderDetail; +import org.gastro.inventory.MenuCard; +import org.gastro.inventory.Offering; +import org.gastro.inventory.Section; +import org.gastro.rcp.IModel; +import org.gastro.rcp.IModel.ITransactionalOperation; + +import java.text.NumberFormat; +import java.util.Iterator; +import java.util.Map; + +public class TableView extends ViewPart +{ + public static final String ID = "org.gastro.rcp.table.view"; + + private static final AdapterFactory FACTORY = IModel.INSTANCE.getAdapterFactory(); + + private static final Map<String, String> fakeImages = new ReferenceValueMap.Soft<String, String>(); + + private static int fakeImageID; + + private TreeViewer menuViewer; + + private Label menuTitle; + + private Label menuDescription; + + private Label menuImage; + + private Label menuPrice; + + private Label quantity; + + private Button buttonDelete; + + private Button buttonAdd; + + private EObject currentItem; + + private Adapter currentItemAdapter = new AdapterImpl() + { + @Override + public void notifyChanged(Notification msg) + { + try + { + menuViewer.getTree().getDisplay().asyncExec(new Runnable() + { + public void run() + { + try + { + showMenuCard(); + } + catch (Exception ex) + { + } + } + }); + } + catch (Exception ex) + { + } + } + }; + + private Order order; + + private OrderDetail orderDetail; + + private Adapter businessDayAdapter = new AdapterImpl() + { + @Override + public void notifyChanged(Notification msg) + { + try + { + menuViewer.getTree().getDisplay().asyncExec(new Runnable() + { + public void run() + { + try + { + menuViewer.setInput(IModel.INSTANCE.getBusinessDay().getMenuCard()); + } + catch (Exception ex) + { + } + } + }); + } + catch (Exception ex) + { + } + } + }; + + private TableViewer orderViewer; + + public TableView() + { + } + + /** + * Passing the focus request to the viewer's control. + */ + public void setFocus() + { + // Do nothing + } + + @Override + public void dispose() + { + IModel.INSTANCE.getBusinessDay().eAdapters().remove(businessDayAdapter); + if (currentItem != null) + { + currentItem.eAdapters().remove(currentItemAdapter); + } + + super.dispose(); + } + + /** + * This is a callback that will allow us to create the viewer and initialize it. + */ + public void createPartControl(Composite parent) + { + BusinessDay businessDay = IModel.INSTANCE.getBusinessDay(); + businessDay.eAdapters().add(businessDayAdapter); + + parent.setLayout(new FillLayout(SWT.VERTICAL)); + { + PShelf shelf = new PShelf(parent, SWT.NONE); + shelf.setForeground(SWTResourceManager.getColor(SWT.COLOR_LIST_SELECTION)); + shelf.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT)); + shelf.setFont(SWTResourceManager.getFont("Comic Sans MS", 24, SWT.BOLD)); + shelf.setRenderer(new org.eclipse.nebula.widgets.pshelf.RedmondShelfRenderer()); + { + PShelfItem shelfItem = new PShelfItem(shelf, SWT.NONE); + GridLayout gridLayout = new GridLayout(3, false); + gridLayout.horizontalSpacing = 0; + gridLayout.marginHeight = 0; + gridLayout.verticalSpacing = 0; + gridLayout.marginWidth = 0; + shelfItem.getBody().setLayout(gridLayout); + { + menuViewer = new TreeViewer(shelfItem.getBody(), SWT.NONE); + menuViewer.addSelectionChangedListener(new ISelectionChangedListener() + { + public void selectionChanged(SelectionChangedEvent event) + { + EObject item = (EObject)((IStructuredSelection)event.getSelection()).getFirstElement(); + if (item != currentItem) + { + if (currentItem != null) + { + currentItem.eAdapters().remove(currentItemAdapter); + } + + if (item != null) + { + item.eAdapters().add(currentItemAdapter); + } + + currentItem = item; + showMenuCard(); + } + } + }); + + menuViewer.setContentProvider(new AdapterFactoryContentProvider(FACTORY)); + menuViewer.setLabelProvider(new AdapterFactoryLabelProvider(FACTORY) + { + @Override + public Image getImage(Object object) + { + return null; + } + }); + + menuViewer.setInput(businessDay.getMenuCard()); + + Tree tree = menuViewer.getTree(); + tree.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE)); + tree.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD)); + { + GridData gridData = new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1); + gridData.widthHint = 300; + tree.setLayoutData(gridData); + } + } + { + Composite composite = new Composite(shelfItem.getBody(), SWT.NONE); + composite.setLayout(new GridLayout(1, false)); + composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + { + menuTitle = new Label(composite, SWT.NONE); + menuTitle.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE)); + menuTitle.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD)); + menuTitle.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); + menuTitle.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); + menuTitle.setText("Titel"); + } + { + Label label = new Label(composite, SWT.SEPARATOR); + { + GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); + gridData.heightHint = 2; + label.setLayoutData(gridData); + } + } + { + menuDescription = new Label(composite, SWT.WRAP); + menuDescription.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE)); + menuDescription.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD)); + menuDescription.setText("Beschreibung"); + menuDescription.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + menuDescription.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); + } + { + Composite composite_1 = new Composite(composite, SWT.NONE); + composite_1.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1)); + composite_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); + GridLayout gridLayout_1 = new GridLayout(2, false); + gridLayout_1.marginWidth = 0; + gridLayout_1.marginHeight = 0; + composite_1.setLayout(gridLayout_1); + { + menuImage = new Label(composite_1, SWT.NONE); + menuImage.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, false, 1, 1)); + menuImage.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); + menuImage.setText("Bild"); + menuImage.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE)); + menuImage.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD)); + } + { + menuPrice = new Label(composite_1, SWT.NONE); + menuPrice.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, false, 1, 1)); + menuPrice.setAlignment(SWT.RIGHT); + menuPrice.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE)); + menuPrice.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD)); + menuPrice.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); + menuPrice.setText("Preis"); + } + } + } + { + Composite composite = new Composite(shelfItem.getBody(), SWT.NONE); + composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); + GridLayout gridLayout_1 = new GridLayout(1, false); + gridLayout_1.marginHeight = 0; + gridLayout_1.marginWidth = 0; + composite.setLayout(gridLayout_1); + composite.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1)); + { + Button buttonPrev = new Button(composite, SWT.NONE); + buttonPrev.setToolTipText("Voriger Eintrag"); + buttonPrev.addSelectionListener(new SelectionAdapter() + { + public void widgetSelected(SelectionEvent e) + { + prevMenu(); + } + }); + buttonPrev.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/up.png")); + } + { + Label label = new Label(composite, SWT.NONE); + label.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1)); + } + { + quantity = new Label(composite, SWT.NONE); + quantity.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE)); + quantity.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); + quantity.setAlignment(SWT.CENTER); + quantity.setFont(SWTResourceManager.getFont("Comic Sans MS", 32, SWT.BOLD)); + quantity.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1)); + quantity.setText("0"); + } + { + Composite composite_1 = new Composite(composite, SWT.NONE); + composite_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); + composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); + FillLayout fillLayout = new FillLayout(SWT.HORIZONTAL); + fillLayout.spacing = 5; + composite_1.setLayout(fillLayout); + { + buttonDelete = new Button(composite_1, SWT.NONE); + buttonDelete.setToolTipText("Weniger bestellen"); + buttonDelete.addSelectionListener(new SelectionAdapter() + { + public void widgetSelected(SelectionEvent e) + { + deleteOrder(); + } + }); + buttonDelete.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/delete.gif")); + } + { + buttonAdd = new Button(composite_1, SWT.NONE); + buttonAdd.setToolTipText("Mehr bestellen"); + buttonAdd.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/add.gif")); + buttonAdd.addSelectionListener(new SelectionAdapter() + { + public void widgetSelected(SelectionEvent e) + { + addOrder(); + } + }); + } + } + { + Label label = new Label(composite, SWT.NONE); + label.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1)); + } + { + Button buttonNext = new Button(composite, SWT.NONE); + buttonNext.setToolTipText("N\u00E4chster Eintrag"); + buttonNext.addSelectionListener(new SelectionAdapter() + { + public void widgetSelected(SelectionEvent e) + { + nextMenu(); + } + }); + buttonNext.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/down.png")); + } + } + shelfItem.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/menucard.png")); + shelfItem.setText(" Speisen und Getr\u00E4nke"); + } + { + PShelfItem shelfItem = new PShelfItem(shelf, SWT.NONE); + GridLayout gridLayout = new GridLayout(2, false); + gridLayout.horizontalSpacing = 0; + gridLayout.verticalSpacing = 0; + gridLayout.marginWidth = 0; + gridLayout.marginHeight = 0; + shelfItem.getBody().setLayout(gridLayout); + { + orderViewer = new TableViewer(shelfItem.getBody(), SWT.HIDE_SELECTION); + + Table table = orderViewer.getTable(); + table.setLinesVisible(true); + table.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE)); + table.setFont(SWTResourceManager.getFont("Comic Sans MS", 16, SWT.BOLD)); + { + GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); + gridData.widthHint = 300; + table.setLayoutData(gridData); + } + { + TableViewerColumn tableViewerColumn = new TableViewerColumn(orderViewer, SWT.NONE); + TableColumn tblclmnQuantity = tableViewerColumn.getColumn(); + tblclmnQuantity.setResizable(false); + tblclmnQuantity.setAlignment(SWT.RIGHT); + tblclmnQuantity.setWidth(70); + tblclmnQuantity.setText("Quantity"); + } + { + TableViewerColumn tableViewerColumn = new TableViewerColumn(orderViewer, SWT.NONE); + TableColumn tblclmnOffering = tableViewerColumn.getColumn(); + tblclmnOffering.setWidth(410); + tblclmnOffering.setText("Offering"); + } + { + TableViewerColumn tableViewerColumn = new TableViewerColumn(orderViewer, SWT.NONE); + TableColumn tblclmnPrice = tableViewerColumn.getColumn(); + tblclmnPrice.setResizable(false); + tblclmnPrice.setAlignment(SWT.RIGHT); + tblclmnPrice.setWidth(100); + tblclmnPrice.setText("Price"); + } + { + TableViewerColumn tableViewerColumn = new TableViewerColumn(orderViewer, SWT.NONE); + TableColumn tblclmnSum = tableViewerColumn.getColumn(); + tblclmnSum.setResizable(false); + tblclmnSum.setAlignment(SWT.RIGHT); + tblclmnSum.setWidth(117); + tblclmnSum.setText("Sum"); + } + + orderViewer.setContentProvider(new AdapterFactoryContentProvider(FACTORY)); + orderViewer.setLabelProvider(new AdapterFactoryLabelProvider(FACTORY) + { + @Override + public String getColumnText(Object object, int columnIndex) + { + switch (columnIndex) + { + case 0: + return "" + ((OrderDetail)object).getQuantity() + "x"; + case 1: + return ((OrderDetail)object).getOffering().getName(); + case 2: + return formatPrice(((OrderDetail)object).getOffering().getPrice()); + case 3: + return formatPrice(((OrderDetail)object).getPrice()); + + default: + return super.getColumnText(object, columnIndex); + } + } + + @Override + public Image getColumnImage(Object object, int columnIndex) + { + return null; + } + }); + } + { + Composite composite = new Composite(shelfItem.getBody(), SWT.NONE); + composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1)); + GridLayout gridLayout_1 = new GridLayout(1, false); + gridLayout_1.marginHeight = 0; + gridLayout_1.marginWidth = 0; + composite.setLayout(gridLayout_1); + composite.setBounds(0, 0, 64, 64); + { + Button buttonCancel = new Button(composite, SWT.NONE); + buttonCancel.addSelectionListener(new SelectionAdapter() + { + public void widgetSelected(SelectionEvent e) + { + cancelOrder(); + } + }); + buttonCancel.setToolTipText("Bestellung abbrechen"); + buttonCancel.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/cancel.png")); + } + { + Label labelTotalPrice = new Label(composite, SWT.NONE); + labelTotalPrice.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); + labelTotalPrice.setAlignment(SWT.CENTER); + labelTotalPrice.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, true, 1, 1)); + } + { + Button buttonSend = new Button(composite, SWT.NONE); + buttonSend.addSelectionListener(new SelectionAdapter() + { + public void widgetSelected(SelectionEvent e) + { + sendOrder(); + } + }); + buttonSend.setToolTipText("Bestellung absenden"); + buttonSend.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/send.png")); + } + } + shelfItem.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/order.png")); + shelfItem.setText(" Bestellung"); + } + { + PShelfItem shelfItem = new PShelfItem(shelf, SWT.NONE); + shelfItem.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/payment.png")); + shelfItem.setText(" Bezahlung"); + } + { + PShelfItem shelfItem = new PShelfItem(shelf, SWT.NONE); + shelfItem.setImage(ResourceManager.getPluginImage("org.gastro.rcp.table", "icons/service.png")); + shelfItem.setText(" Service"); + } + + shelf.addSelectionListener(new SelectionAdapter() + { + public void widgetSelected(SelectionEvent e) + { + orderViewer.refresh(true); + } + }); + + createNewOrder(); + } + } + + protected void nextMenu() + { + EList<EObject> menuItems = getAllMenuItems(); + int index = menuItems.indexOf(currentItem); + if (index >= 0 && index < menuItems.size() - 1) + { + menuViewer.setSelection(new StructuredSelection(menuItems.get(index + 1))); + } + } + + protected void prevMenu() + { + EList<EObject> menuItems = getAllMenuItems(); + int index = menuItems.indexOf(currentItem); + if (index > 0) + { + menuViewer.setSelection(new StructuredSelection(menuItems.get(index - 1))); + } + } + + protected void showMenuCard() + { + OrderDetail oldOrderDetail = orderDetail; + if (currentItem instanceof Section) + { + Section section = (Section)currentItem; + updateMenuDetail( // + section.getTitle(), // + section.getText(), // + null, // + false); + orderDetail = null; + } + else if (currentItem instanceof Offering) + { + Offering offering = (Offering)currentItem; + updateMenuDetail( // + offering.getName(), // + offering.getDescription(), // + formatPrice(offering.getPrice()), // + true); + orderDetail = getOrderDetail(offering); + } + + if (oldOrderDetail != null && oldOrderDetail != orderDetail) + { + if (oldOrderDetail.getQuantity() == 0) + { + order.getOrderDetails().remove(oldOrderDetail); + } + } + + updateOrderDetail(); + } + + protected void addOrder() + { + if (orderDetail == null) + { + orderDetail = BusinessFactory.eINSTANCE.createOrderDetail(); + orderDetail.setOffering((Offering)currentItem); + orderDetail.setQuantity(1); + order.getOrderDetails().add(orderDetail); + } + else + { + orderDetail.setQuantity(orderDetail.getQuantity() + 1); + } + + updateOrderDetail(); + } + + protected void deleteOrder() + { + int quantity = orderDetail.getQuantity(); + if (quantity == 1) + { + order.getOrderDetails().remove(orderDetail); + orderDetail = null; + } + else + { + orderDetail.setQuantity(quantity - 1); + } + + updateOrderDetail(); + } + + protected void sendOrder() + { + ITransactionalOperation<BusinessDay> operation = new ITransactionalOperation<BusinessDay>() + { + public Object execute(BusinessDay businessDay) + { + businessDay.cdoWriteLock().lock(); + EList<Order> orders = businessDay.getOrders(); + order.setNumber(getNextOrderNumber(orders)); + orders.add(order); + return null; + } + }; + + IModel.INSTANCE.modify(IModel.INSTANCE.getBusinessDay(), operation); + createNewOrder(); + } + + protected void cancelOrder() + { + createNewOrder(); + } + + private EList<EObject> getAllMenuItems() + { + MenuCard menuCard = (MenuCard)menuViewer.getInput(); + EList<EObject> result = new BasicEList<EObject>(); + for (Iterator<EObject> it = menuCard.eAllContents(); it.hasNext();) + { + result.add((EObject)it.next()); + } + + return result; + } + + private void createNewOrder() + { + order = BusinessFactory.eINSTANCE.createOrder(); + order.setTable((org.gastro.inventory.Table)IModel.INSTANCE.getStation()); + orderViewer.setInput(order); + + orderDetail = null; + updateOrderDetail(); + } + + private int getNextOrderNumber(EList<Order> orders) + { + int count = orders.size(); + if (count > 0) + { + return orders.get(count - 1).getNumber() + 1; + } + + return 1; + } + + private OrderDetail getOrderDetail(Offering offering) + { + for (OrderDetail orderDetail : order.getOrderDetails()) + { + if (orderDetail.getOffering() == offering) + { + return orderDetail; + } + } + + return null; + } + + private void updateMenuDetail(String title, String description, String price, boolean withImage) + { + menuTitle.setText(StringUtil.safe(title)); + menuDescription.setText(StringUtil.safe(description)); + menuPrice.setText(StringUtil.safe(price)); + + if (title == null || !withImage) + { + menuImage.setImage(null); + } + else + { + String name = fakeImages.get(title); + if (name == null) + { + for (;;) + { + name = "meal-" + (++fakeImageID); + Image image = getCachedImage(name); + if (image != null) + { + fakeImages.put(title, name); + menuImage.setImage(getCachedImage(name)); + break; + } + + fakeImageID = 0; + } + } + else + { + menuImage.setImage(getCachedImage(name)); + } + } + + menuImage.getParent().getParent().layout(true); + } + + private void updateOrderDetail() + { + if (currentItem instanceof Offering) + { + if (orderDetail != null) + { + quantity.setText("" + orderDetail.getQuantity()); + buttonDelete.setEnabled(true); + } + else + { + quantity.setText("0"); + buttonDelete.setEnabled(false); + } + + quantity.setVisible(true); + buttonAdd.setVisible(true); + buttonDelete.setVisible(true); + } + else + { + quantity.setVisible(false); + buttonAdd.setVisible(false); + buttonDelete.setVisible(false); + } + } + + private Image getCachedImage(String name) + { + return ResourceManager.getPluginImage("org.gastro.rcp.table", "images/" + name + ".png"); + } + + private String formatPrice(float price) + { + return NumberFormat.getCurrencyInstance().format(price); + } +} |