| @@ -0,0 +1,17 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <projectDescription> | |||||
| <name>de.wt.bgg.feature</name> | |||||
| <comment></comment> | |||||
| <projects> | |||||
| </projects> | |||||
| <buildSpec> | |||||
| <buildCommand> | |||||
| <name>org.eclipse.pde.FeatureBuilder</name> | |||||
| <arguments> | |||||
| </arguments> | |||||
| </buildCommand> | |||||
| </buildSpec> | |||||
| <natures> | |||||
| <nature>org.eclipse.pde.FeatureNature</nature> | |||||
| </natures> | |||||
| </projectDescription> | |||||
| @@ -0,0 +1 @@ | |||||
| bin.includes = feature.xml | |||||
| @@ -0,0 +1,27 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <feature | |||||
| id="de.wt.bgg.feature" | |||||
| label="Feature" | |||||
| version="1.0.0.qualifier" | |||||
| provider-name="Veroni"> | |||||
| <description url="http://www.example.com/description"> | |||||
| [Enter Feature Description here.] | |||||
| </description> | |||||
| <copyright url="http://www.example.com/copyright"> | |||||
| [Enter Copyright Description here.] | |||||
| </copyright> | |||||
| <license url="http://www.example.com/license"> | |||||
| [Enter License Description here.] | |||||
| </license> | |||||
| <plugin | |||||
| id="de.wt.bgg.ui" | |||||
| download-size="0" | |||||
| install-size="0" | |||||
| version="0.0.0" | |||||
| unpack="false"/> | |||||
| </feature> | |||||
| @@ -0,0 +1,11 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <projectDescription> | |||||
| <name>de.wt.bgg.product</name> | |||||
| <comment></comment> | |||||
| <projects> | |||||
| </projects> | |||||
| <buildSpec> | |||||
| </buildSpec> | |||||
| <natures> | |||||
| </natures> | |||||
| </projectDescription> | |||||
| @@ -0,0 +1,56 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <?pde version="3.5"?> | |||||
| <product name="BggToolAnother" uid="bggtoolanother" id="de.wt.bgg.ui.anotherproduct" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="1.0.0" useFeatures="true" includeLaunchers="true"> | |||||
| <configIni use="default"> | |||||
| </configIni> | |||||
| <launcherArgs> | |||||
| <programArgs>-clearPersistedState | |||||
| </programArgs> | |||||
| <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts | |||||
| </vmArgsMac> | |||||
| </launcherArgs> | |||||
| <windowImages/> | |||||
| <launcher> | |||||
| <win useIco="false"> | |||||
| <bmp/> | |||||
| </win> | |||||
| </launcher> | |||||
| <vm> | |||||
| </vm> | |||||
| <plugins> | |||||
| </plugins> | |||||
| <features> | |||||
| <feature id="de.wt.bgg.feature" installMode="root"/> | |||||
| <feature id="org.eclipse.e4.rcp" installMode="root"/> | |||||
| <feature id="org.eclipse.emf.common" installMode="root"/> | |||||
| <feature id="org.eclipse.emf.ecore" installMode="root"/> | |||||
| </features> | |||||
| <configurations> | |||||
| <plugin id="org.apache.felix.scr" autoStart="true" startLevel="2" /> | |||||
| <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" /> | |||||
| <plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" /> | |||||
| <plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" /> | |||||
| <plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" /> | |||||
| </configurations> | |||||
| <preferencesInfo> | |||||
| <targetfile overwrite="false"/> | |||||
| </preferencesInfo> | |||||
| <cssInfo> | |||||
| </cssInfo> | |||||
| </product> | |||||
| @@ -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/JavaSE-1.8"/> | |||||
| <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | |||||
| <classpathentry kind="src" path="src"/> | |||||
| <classpathentry kind="output" path="bin"/> | |||||
| </classpath> | |||||
| @@ -0,0 +1,28 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <projectDescription> | |||||
| <name>de.wt.bgg.ui</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> | |||||
| @@ -0,0 +1,34 @@ | |||||
| <?xml version="1.0" encoding="ASCII"?> | |||||
| <application:Application xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:advanced="http://www.eclipse.org/ui/2010/UIModel/application/ui/advanced" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmi:id="_Lw_ZsEqSEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.application"> | |||||
| <children xsi:type="basic:TrimmedWindow" xmi:id="_QDxdgEqSEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.trimmedwindow.main" label="BGG Tool Another" width="1024" height="800"> | |||||
| <children xsi:type="basic:PartSashContainer" xmi:id="_B_h_UEqVEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.partsashcontainer.0"> | |||||
| <children xsi:type="basic:PartSashContainer" xmi:id="_tbnr0EqTEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.partsashcontainer.main" horizontal="true"> | |||||
| <children xsi:type="basic:PartSashContainer" xmi:id="_4NsHQEqTEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.partsashcontainer.bggload"> | |||||
| <children xsi:type="basic:PartStack" xmi:id="_7KNiwEqTEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.partstack.bggloadconf" containerData="1000"> | |||||
| <children xsi:type="basic:Part" xmi:id="_9ocfwEqTEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.part.resultconfig" contributionURI="bundleclass://de.wt.bgg.ui/de.wt.bgg.ui.parts.LoadFromBggPart" label="Load IDs from BGG"/> | |||||
| </children> | |||||
| <children xsi:type="basic:PartStack" xmi:id="_7hQw0EqTEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.partstack.bggresult" containerData="3000"> | |||||
| <children xsi:type="basic:Part" xmi:id="_97XbwEqTEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.part.resulttable" contributionURI="bundleclass://de.wt.bgg.ui/de.wt.bgg.ui.parts.BggResultPart" label="BGG Result"/> | |||||
| </children> | |||||
| </children> | |||||
| <children xsi:type="basic:PartSashContainer" xmi:id="_AF1vQEqUEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.partsashcontainer.gamelist"> | |||||
| <children xsi:type="basic:PartStack" xmi:id="_0MbRQEqTEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.partstack.gameslistconf"> | |||||
| <children xsi:type="basic:Part" xmi:id="_-Mdy0EqTEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.part.gamesconfig" contributionURI="bundleclass://de.wt.bgg.ui/de.wt.bgg.ui.parts.LoadGameDetailsPart" label="Load game details"/> | |||||
| </children> | |||||
| <children xsi:type="basic:PartStack" xmi:id="_CS1yUEqUEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.partstack.gameslist"> | |||||
| <children xsi:type="basic:Part" xmi:id="_Ckm3wEqUEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.part.gamestable" contributionURI="bundleclass://de.wt.bgg.ui/de.wt.bgg.ui.parts.GamesListPart" label="Games list"/> | |||||
| </children> | |||||
| </children> | |||||
| </children> | |||||
| <children xsi:type="advanced:Area" xmi:id="_8nEs4EqUEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.area.status" containerData="100" label="Status"/> | |||||
| </children> | |||||
| <mainMenu xmi:id="_wtXeQEs0EeqGDvPDavxXPQ" elementId="org.eclipse.ui.main.menu"/> | |||||
| </children> | |||||
| <addons xmi:id="_Lw_ZsUqSEeqT5sxfmvJ5Tg" elementId="org.eclipse.e4.core.commands.service" contributionURI="bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"/> | |||||
| <addons xmi:id="_Lw_ZskqSEeqT5sxfmvJ5Tg" elementId="org.eclipse.e4.ui.contexts.service" contributionURI="bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"/> | |||||
| <addons xmi:id="_Lw_Zs0qSEeqT5sxfmvJ5Tg" elementId="org.eclipse.e4.ui.bindings.service" contributionURI="bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"/> | |||||
| <addons xmi:id="_Lw_ZtEqSEeqT5sxfmvJ5Tg" elementId="org.eclipse.e4.ui.workbench.commands.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon"/> | |||||
| <addons xmi:id="_Lw_ZtUqSEeqT5sxfmvJ5Tg" elementId="org.eclipse.e4.ui.workbench.contexts.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"/> | |||||
| <addons xmi:id="_Lw_ZtkqSEeqT5sxfmvJ5Tg" elementId="org.eclipse.e4.ui.workbench.bindings.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon"/> | |||||
| <addons xmi:id="_Lw_Zt0qSEeqT5sxfmvJ5Tg" elementId="org.eclipse.e4.ui.workbench.handler.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon"/> | |||||
| </application:Application> | |||||
| @@ -0,0 +1,17 @@ | |||||
| Manifest-Version: 1.0 | |||||
| Bundle-ManifestVersion: 2 | |||||
| Bundle-Name: Secondtry | |||||
| Bundle-SymbolicName: de.wt.bgg.ui;singleton:=true | |||||
| Bundle-Version: 1.0.0.qualifier | |||||
| Automatic-Module-Name: de.wt.secondtry | |||||
| Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | |||||
| Require-Bundle: org.eclipse.core.runtime;bundle-version="3.17.0", | |||||
| org.eclipse.swt;bundle-version="3.113.0", | |||||
| org.eclipse.e4.core.di;bundle-version="1.7.500", | |||||
| org.eclipse.e4.ui.workbench;bundle-version="1.11.0", | |||||
| org.eclipse.e4.ui.di;bundle-version="1.2.700", | |||||
| org.eclipse.e4.core.di.extensions;bundle-version="0.15.400", | |||||
| javax.annotation;bundle-version="1.2.0", | |||||
| org.eclipse.jface;bundle-version="3.18.0" | |||||
| Import-Package: org.eclipse.e4.ui.model.application.descriptor.basic, | |||||
| org.eclipse.e4.ui.model.application.ui.basic | |||||
| @@ -0,0 +1,5 @@ | |||||
| output.. = bin/ | |||||
| bin.includes = META-INF/,\ | |||||
| .,\ | |||||
| Application.e4xmi | |||||
| source.. = src/ | |||||
| @@ -0,0 +1,18 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <?eclipse version="3.4"?> | |||||
| <plugin> | |||||
| <extension | |||||
| id="anotherproduct" | |||||
| point="org.eclipse.core.runtime.products"> | |||||
| <product | |||||
| name="BggToolAnother" | |||||
| application="org.eclipse.e4.ui.workbench.swt.E4Application"> | |||||
| <property | |||||
| name="appName" | |||||
| value="BggToolAnother"> | |||||
| </property> | |||||
| </product> | |||||
| </extension> | |||||
| </plugin> | |||||
| @@ -0,0 +1,6 @@ | |||||
| package de.wt.bgg.data; | |||||
| /// This class contains and handles the result table for initial BGG result | |||||
| public class BggResult { | |||||
| } | |||||
| @@ -0,0 +1,86 @@ | |||||
| package de.wt.bgg.ui.contributions; | |||||
| import org.eclipse.swt.SWT; | |||||
| import org.eclipse.swt.layout.GridData; | |||||
| import org.eclipse.swt.layout.GridLayout; | |||||
| import org.eclipse.swt.widgets.Button; | |||||
| import org.eclipse.swt.widgets.Combo; | |||||
| import org.eclipse.swt.widgets.Composite; | |||||
| import org.eclipse.swt.widgets.Group; | |||||
| import org.eclipse.swt.widgets.Label; | |||||
| /// These are the controls to retrieve IDs for a given BGG user | |||||
| /// Filters can be set for the state of the thing in the user's collection | |||||
| /// (i.e. owned, previously owned, wishlist, etc.) | |||||
| public class SourceFilterBggUser extends Composite { | |||||
| public SourceFilterBggUser(final Composite parent, int style) { | |||||
| super(parent, style); | |||||
| Group gFilters = new Group(parent, SWT.SHADOW_ETCHED_IN); | |||||
| gFilters.setText(""); | |||||
| GridData gdFilters = new GridData(SWT.FILL, SWT.FILL, true, true); | |||||
| gFilters.setLayoutData(gdFilters); | |||||
| GridLayout filterLayout = new GridLayout(4, false); | |||||
| gFilters.setLayout(filterLayout); | |||||
| Label lblUser = new Label(gFilters, SWT.LEFT); | |||||
| lblUser.setText("User name: "); | |||||
| lblUser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||||
| Combo cbUserName = new Combo(gFilters, SWT.DROP_DOWN); | |||||
| cbUserName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||||
| Button btEditUsers = new Button(gFilters, SWT.PUSH); | |||||
| btEditUsers.setText("edit users"); | |||||
| btEditUsers.setEnabled(false); | |||||
| btEditUsers.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||||
| // TODO: implement edit users | |||||
| Label infoLabel = new Label(gFilters, SWT.LEFT); | |||||
| infoLabel.setText("Select which flags are used as filter. Filters follow 'AND' rule."); | |||||
| GridData gdInfo = new GridData(SWT.FILL, SWT.FILL, true, false); | |||||
| gdInfo.horizontalSpan = 4; | |||||
| infoLabel.setLayoutData(gdInfo); | |||||
| makeFilter(gFilters, "owned", 1); | |||||
| makeFilter(gFilters, "want to play", 2); | |||||
| makeFilter(gFilters, "previously owned", 2); | |||||
| makeFilter(gFilters, "want to buy", 2); | |||||
| makeFilter(gFilters, "for trade", 0); | |||||
| makeFilter(gFilters, "wishlist", 2); | |||||
| makeFilter(gFilters, "wanted", 2); | |||||
| makeFilter(gFilters, "preordered", 2); | |||||
| this.requestLayout(); | |||||
| } | |||||
| /// Create a control for a filter. | |||||
| // Filters are tristate: include iff has flag, include iff it does not have the flag, | |||||
| // don't care if it has that flag. | |||||
| // TODO: are there more convenient widgets for this? drop-down needs two clicks to set... | |||||
| private void makeFilter(Composite parent, String filterName, int defaultIdx) { | |||||
| Combo filterCombo = new Combo(parent, SWT.READ_ONLY); | |||||
| filterCombo.add("ignored"); | |||||
| filterCombo.add("is"); | |||||
| filterCombo.add("is not"); | |||||
| filterCombo.select(defaultIdx); | |||||
| filterCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||||
| Label filterLabel = new Label(parent, SWT.LEFT); | |||||
| filterLabel.setText(filterName); | |||||
| filterLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||||
| } | |||||
| public String toString() { | |||||
| return "from BGG user"; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,37 @@ | |||||
| package de.wt.bgg.ui.contributions; | |||||
| import org.eclipse.swt.SWT; | |||||
| import org.eclipse.swt.layout.GridData; | |||||
| import org.eclipse.swt.layout.GridLayout; | |||||
| import org.eclipse.swt.widgets.Combo; | |||||
| import org.eclipse.swt.widgets.Composite; | |||||
| import org.eclipse.swt.widgets.Group; | |||||
| import org.eclipse.swt.widgets.Label; | |||||
| public class SourceFilterGeeklist extends Composite { | |||||
| public SourceFilterGeeklist(final Composite parent, int style) { | |||||
| super(parent, style); | |||||
| Group gFilters = new Group(parent, SWT.SHADOW_ETCHED_IN); | |||||
| gFilters.setText("Filters"); | |||||
| GridData gdFilters = new GridData(SWT.FILL, SWT.FILL, true, true); | |||||
| gFilters.setLayoutData(gdFilters); | |||||
| GridLayout filterLayout = new GridLayout(2, false); | |||||
| gFilters.setLayout(filterLayout); | |||||
| Label lblGeeklist = new Label(gFilters, SWT.LEFT); | |||||
| lblGeeklist.setText("Geeklist ID: "); | |||||
| lblGeeklist.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||||
| Combo cbGeeklistId = new Combo(gFilters, SWT.DROP_DOWN); | |||||
| cbGeeklistId.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||||
| this.requestLayout(); | |||||
| } | |||||
| public String toString() { | |||||
| return "from Geeklist"; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,19 @@ | |||||
| package de.wt.bgg.ui.parts; | |||||
| import javax.annotation.PostConstruct; | |||||
| import org.eclipse.swt.SWT; | |||||
| //import org.eclipse.swt.layout.GridData; | |||||
| import org.eclipse.swt.widgets.Composite; | |||||
| import org.eclipse.swt.widgets.Label; | |||||
| public class BggResultPart { | |||||
| @PostConstruct | |||||
| public void createControls(Composite parent) { | |||||
| //GridData tableGrid = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL); | |||||
| Label lblTable = new Label(parent, SWT.LEFT); | |||||
| lblTable.setText("I am a table"); | |||||
| //lblTable.setLayoutData(tableGrid); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,5 @@ | |||||
| package de.wt.bgg.ui.parts; | |||||
| public class GamesListPart { | |||||
| } | |||||
| @@ -0,0 +1,178 @@ | |||||
| package de.wt.bgg.ui.parts; | |||||
| import java.util.Arrays; | |||||
| import java.util.List; | |||||
| import javax.annotation.PostConstruct; | |||||
| import org.eclipse.jface.viewers.ArrayContentProvider; | |||||
| import org.eclipse.jface.viewers.ComboViewer; | |||||
| 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.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.GridData; | |||||
| import org.eclipse.swt.layout.GridLayout; | |||||
| import org.eclipse.swt.widgets.Button; | |||||
| import org.eclipse.swt.widgets.Composite; | |||||
| import org.eclipse.swt.widgets.Display; | |||||
| import org.eclipse.swt.widgets.Group; | |||||
| import org.eclipse.swt.widgets.Label; | |||||
| import de.wt.bgg.ui.contributions.SourceFilterBggUser; | |||||
| import de.wt.bgg.ui.contributions.SourceFilterGeeklist; | |||||
| /// Has controls to download a list of thing IDs (+some meta info) from BGG. | |||||
| /// There are different ways to configure which IDs to retrieve. | |||||
| public class LoadFromBggPart { | |||||
| private Composite parent; | |||||
| private Composite filterComposite; //< current composite that is shown in filter area | |||||
| /// show different filter controls depending on selection in cbSource ComboViewer | |||||
| public void showFilter(IStructuredSelection selection) { | |||||
| String elem = (String) selection.getFirstElement(); | |||||
| // we already have the selected filter area in place, do nothing | |||||
| if(filterComposite != null && filterComposite.toString() == elem) { | |||||
| return; | |||||
| } | |||||
| // if we need a different filter area, dispose the old one before creating a new one | |||||
| if(filterComposite != null) { | |||||
| filterComposite.dispose(); | |||||
| } | |||||
| // now that we know the composite is either null or a different one from the one already shown, | |||||
| // and the old one was disposed above, create the new one: | |||||
| if(elem == "from BGG user") { | |||||
| System.out.println("construct " + elem); | |||||
| filterComposite = new SourceFilterBggUser(parent, SWT.FILL); | |||||
| filterComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); | |||||
| parent.requestLayout(); | |||||
| } else if (elem == "from geeklist") { | |||||
| System.out.println("construct " + elem); | |||||
| filterComposite = new SourceFilterGeeklist(parent, SWT.FILL); | |||||
| filterComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); | |||||
| parent.requestLayout(); | |||||
| } else { | |||||
| System.out.println("construct " + elem + " (not implemented yet, try another one)"); | |||||
| } | |||||
| } | |||||
| public static Display getDisplay() { | |||||
| Display display = Display.getCurrent(); | |||||
| // may be null if outside the UI thread | |||||
| if (display == null) | |||||
| display = Display.getDefault(); | |||||
| return display; | |||||
| } | |||||
| @PostConstruct | |||||
| public void createControls(Composite parent) { | |||||
| this.parent = parent; | |||||
| // TODO: where do I define this properly? child setting the layout of its parent doesn't feel right | |||||
| GridLayout layout = new GridLayout(2, false); | |||||
| parent.setLayout(layout); | |||||
| // contains configuration options for download of the bgg thing ID list | |||||
| Group dlConfigGroup = new Group(parent, SWT.SHADOW_ETCHED_IN); | |||||
| GridData configGrid = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL); | |||||
| dlConfigGroup.setText("Configure download..."); | |||||
| dlConfigGroup.setLayoutData(configGrid); | |||||
| GridLayout layoutG = new GridLayout(2, false); | |||||
| dlConfigGroup.setLayout(layoutG); | |||||
| Label lblSource = new Label(dlConfigGroup, SWT.LEFT); | |||||
| lblSource.setText("Source: "); | |||||
| lblSource.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); | |||||
| // choose the bgg data source | |||||
| ComboViewer cbSource = new ComboViewer(dlConfigGroup, SWT.READ_ONLY); | |||||
| cbSource.setContentProvider(ArrayContentProvider.getInstance()); | |||||
| List<String> sources = Arrays.asList(new String[] { "from BGG user", "from geeklist", "from family", "by rank", "by year", "by age", "search"}); | |||||
| cbSource.setInput(sources); | |||||
| // TODO: implement all the sources | |||||
| cbSource.setSelection(new StructuredSelection(sources.get(0))); | |||||
| cbSource.addSelectionChangedListener(new ISelectionChangedListener() { | |||||
| @Override | |||||
| public void selectionChanged(SelectionChangedEvent event) { | |||||
| IStructuredSelection selection = (IStructuredSelection) event | |||||
| .getSelection(); | |||||
| if (selection.size() > 0) { | |||||
| showFilter(selection); | |||||
| } | |||||
| } | |||||
| }); | |||||
| // choose the bgg sub-site | |||||
| Label lblTopic = new Label(dlConfigGroup, SWT.LEFT); | |||||
| lblTopic.setText("Subpage: "); | |||||
| lblTopic.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); | |||||
| ComboViewer cbTopic = new ComboViewer(dlConfigGroup, SWT.READ_ONLY); | |||||
| cbTopic.setContentProvider(ArrayContentProvider.getInstance()); | |||||
| List<String> sites = Arrays.asList(new String[] { "Boardgames", "RPGs", "RPG Items", "Videogames", "Accessories" }); | |||||
| cbTopic.setInput(sites); | |||||
| cbTopic.setSelection(new StructuredSelection(sites.get(0))); | |||||
| // choose action on result list | |||||
| Label lblAct = new Label(dlConfigGroup, SWT.LEFT); | |||||
| lblAct.setText("Action on result: "); | |||||
| lblAct.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); | |||||
| ComboViewer cbAct = new ComboViewer(dlConfigGroup, SWT.READ_ONLY); | |||||
| cbAct.setContentProvider(ArrayContentProvider.getInstance()); | |||||
| List<String> actions = Arrays.asList(new String[] { "add", "replace", "subtract", "AND", "Mis"}); | |||||
| cbAct.setInput(actions); | |||||
| cbAct.setSelection(new StructuredSelection(actions.get(0))); | |||||
| // prepare area to display filter controls in | |||||
| // filterArea = new Composite(parent, SWT.FILL); | |||||
| // filterArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||||
| showFilter((IStructuredSelection)cbSource.getSelection()); // set content to initial selection | |||||
| // Start retrieval when download button is pushed | |||||
| Button btDownload = new Button(parent, SWT.PUSH); | |||||
| // TODO: how do I locate icons? | |||||
| try { | |||||
| Image dlIcon = new Image(getDisplay(), | |||||
| getClass().getResourceAsStream("C:\\Users/goya/workspace/icons/icons/material_design/png/download-button.png")); | |||||
| btDownload.setImage(dlIcon); | |||||
| } | |||||
| catch(Exception ex) { | |||||
| btDownload.setText("Download now"); | |||||
| } | |||||
| btDownload.addSelectionListener(new SelectionAdapter() { | |||||
| @Override | |||||
| public void widgetSelected(SelectionEvent e) { | |||||
| System.out.println("Called!"); | |||||
| } | |||||
| }); | |||||
| btDownload.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false)); | |||||
| } | |||||
| // DISPOSE images! | |||||
| } | |||||
| @@ -0,0 +1,5 @@ | |||||
| package de.wt.bgg.ui.parts; | |||||
| public class LoadGameDetailsPart { | |||||
| } | |||||