project to use gson (no success)pull/2/head
| @@ -1,7 +1,16 @@ | |||
| <?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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> | |||
| <attributes> | |||
| <attribute name="maven.pomderived" value="true"/> | |||
| </attributes> | |||
| </classpathentry> | |||
| <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | |||
| <classpathentry kind="src" path="src"/> | |||
| <classpathentry kind="output" path="bin"/> | |||
| <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | |||
| <attributes> | |||
| <attribute name="maven.pomderived" value="true"/> | |||
| </attributes> | |||
| </classpathentry> | |||
| <classpathentry kind="output" path="target/classes"/> | |||
| </classpath> | |||
| @@ -0,0 +1 @@ | |||
| /target/ | |||
| @@ -20,8 +20,14 @@ | |||
| <arguments> | |||
| </arguments> | |||
| </buildCommand> | |||
| <buildCommand> | |||
| <name>org.eclipse.m2e.core.maven2Builder</name> | |||
| <arguments> | |||
| </arguments> | |||
| </buildCommand> | |||
| </buildSpec> | |||
| <natures> | |||
| <nature>org.eclipse.m2e.core.maven2Nature</nature> | |||
| <nature>org.eclipse.pde.PluginNature</nature> | |||
| <nature>org.eclipse.jdt.core.javanature</nature> | |||
| </natures> | |||
| @@ -1,17 +1,25 @@ | |||
| <?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:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmi:id="_Lw_ZsEqSEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.application"> | |||
| <children xsi:type="basic:TrimmedWindow" xmi:id="_QDxdgEqSEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.trimmedwindow.main" label="BGG Tool Another" width="1200" height="800"> | |||
| <children xsi:type="basic:TrimmedWindow" xmi:id="_QDxdgEqSEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.trimmedwindow.main" label="BGG Tool Another" width="1600" height="900"> | |||
| <children xsi:type="basic:PartSashContainer" xmi:id="_B_h_UEqVEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.partsashcontainer.0"> | |||
| <children xsi:type="basic:PartSashContainer" xmi:id="_tbnr0EqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.partsashcontainer.main" horizontal="true"> | |||
| <children xsi:type="basic:PartSashContainer" xmi:id="_4NsHQEqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.partsashcontainer.bggload"> | |||
| <children xsi:type="basic:PartStack" xmi:id="_7KNiwEqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.partstack.bggloadconf" containerData="1400"> | |||
| <children xsi:type="basic:Part" xmi:id="_9ocfwEqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.part.resultconfig" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.parts.LoadFromBggPart" label="Prepare"/> | |||
| <children xsi:type="basic:Part" xmi:id="_-Mdy0EqTEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.part.gamesconfig" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.parts.LoadThingDetailsPart" label="Download games"/> | |||
| <children xsi:type="basic:PartSashContainer" xmi:id="_4NsHQEqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.partsashcontainer.left"> | |||
| <children xsi:type="basic:PartStack" xmi:id="_7KNiwEqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.partstack.leftupper" containerData="800"> | |||
| <children xsi:type="basic:Part" xmi:id="_9ocfwEqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.part.resultconfig" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.parts.PreparePart" label="Prepare"/> | |||
| </children> | |||
| <children xsi:type="basic:PartStack" xmi:id="_0OB_gJ2wEeqjssfAjxHZ-w" elementId="xyz.veronie.bgg.ui.partstack.leftlower" containerData="800"> | |||
| <children xsi:type="basic:Part" xmi:id="_97XbwEqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.part.resulttable" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.parts.BggResultPart" label="BGG Result"> | |||
| <toolbar xmi:id="_ZZOF8J3AEeqjssfAjxHZ-w" elementId="xyz.veronie.bgg.ui.toolbar.0"> | |||
| <children xsi:type="menu:DirectToolItem" xmi:id="_c42V4J29EeqjssfAjxHZ-w" elementId="xyz.veronie.bgg.ui.directtoolitem.saveResult" label="save result" iconURI="platform:/plugin/xyz.veronie.bgg.ui/icons/save-button.png" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.handlers.HandleSaveGamelist"/> | |||
| </toolbar> | |||
| </children> | |||
| </children> | |||
| </children> | |||
| <children xsi:type="basic:PartSashContainer" xmi:id="_AF1vQEqUEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.partsashcontainer.gamelist"> | |||
| <children xsi:type="basic:PartStack" xmi:id="_0MbRQEqTEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.partstack.gameslist" containerData="300"> | |||
| <children xsi:type="basic:Part" xmi:id="_97XbwEqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.part.resulttable" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.parts.BggResultPart" label="BGG Result"/> | |||
| <children xsi:type="basic:PartSashContainer" xmi:id="_AF1vQEqUEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.partsashcontainer.right"> | |||
| <children xsi:type="basic:PartStack" xmi:id="_0MbRQEqTEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.partstack.rightupper" containerData="800"> | |||
| <children xsi:type="basic:Part" xmi:id="_-Mdy0EqTEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.part.gamesconfig" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.parts.DownloadThingDetailsPart" label="Download games"/> | |||
| </children> | |||
| <children xsi:type="basic:PartStack" xmi:id="_2M6HAJ2wEeqjssfAjxHZ-w" elementId="xyz.veronie.bgg.ui.rightlower" containerData="800"> | |||
| <children xsi:type="basic:Part" xmi:id="_Ckm3wEqUEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.part.gamestable" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.parts.ThingListPart" label="Games list"/> | |||
| </children> | |||
| </children> | |||
| @@ -21,6 +29,9 @@ | |||
| <trimBars xmi:id="_I6MLEFv-EeqNgfoocONcgg" elementId="xyz.veronie.bgg.ui.trimbar.bottom" side="Bottom"> | |||
| <children xsi:type="menu:ToolControl" xmi:id="_JQ6B8Fv-EeqNgfoocONcgg" elementId="xyz.veronie.bgg.ui.toolcontrol.status" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.parts.StatusBar"/> | |||
| </trimBars> | |||
| <trimBars xmi:id="__2T2oIubEeqEpr8WQZMuMQ" elementId="xyz.veronie.bgg.ui.trimbar.0"> | |||
| <children xsi:type="menu:ToolBar" xmi:id="_AX9yMIucEeqEpr8WQZMuMQ" elementId="xyz.veronie.bgg.ui.toolbar.testbar"/> | |||
| </trimBars> | |||
| </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"/> | |||
| @@ -13,10 +13,10 @@ Require-Bundle: org.eclipse.core.runtime, | |||
| org.eclipse.jface, | |||
| org.eclipse.e4.core.services, | |||
| org.eclipse.osgi.services, | |||
| javax.inject | |||
| javax.inject, | |||
| org.eclipse.e4.ui.model.workbench | |||
| Automatic-Module-Name: de.wt.secondtry | |||
| Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | |||
| Import-Package: com.google.gson;version="2.8.2", | |||
| javax.inject;version="1.0.0", | |||
| Import-Package: javax.inject;version="1.0.0", | |||
| org.eclipse.e4.ui.model.application.descriptor.basic, | |||
| org.eclipse.e4.ui.model.application.ui.basic | |||
| @@ -1,5 +1,6 @@ | |||
| output.. = bin/ | |||
| bin.includes = META-INF/,\ | |||
| .,\ | |||
| plugin.xml,\ | |||
| Application.e4xmi | |||
| source.. = src/ | |||
| @@ -8,7 +8,7 @@ | |||
| <artifactId>xyz.veronie.bgg.ui</artifactId> | |||
| <version>0.0.1-SNAPSHOT</version> | |||
| <name>xyz.veronie.bgg.ui2</name> | |||
| <name>xyz.veronie.bgg.ui</name> | |||
| <!-- FIXME change it to the project's website --> | |||
| <url>http://www.example.com</url> | |||
| @@ -19,17 +19,17 @@ | |||
| </properties> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>com.google.code.gson</groupId> | |||
| <artifactId>gson</artifactId> | |||
| <version>2.8.6</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>junit</groupId> | |||
| <artifactId>junit</artifactId> | |||
| <version>4.11</version> | |||
| <scope>test</scope> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.google.code.gson</groupId> | |||
| <artifactId>gson</artifactId> | |||
| <version>2.8.6</version> | |||
| </dependency> | |||
| </dependencies> | |||
| <build> | |||
| @@ -1,5 +0,0 @@ | |||
| package xyz.veronie.bgg.result; | |||
| public class BggFamily { | |||
| } | |||
| @@ -6,17 +6,12 @@ import java.io.IOException; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.function.Predicate; | |||
| import xyz.veronie.bgg.result.ThingMetaData; | |||
| import javax.inject.Inject; | |||
| import org.eclipse.e4.core.di.annotations.Optional; | |||
| import org.eclipse.e4.ui.di.UIEventTopic; | |||
| import org.eclipse.core.runtime.Path; | |||
| import com.google.gson.Gson; | |||
| import xyz.veronie.bgg.types.EventConstants; | |||
| import xyz.veronie.bgg.types.SourceFilter; | |||
| public enum ThingProvider { | |||
| INSTANCE; | |||
| @@ -48,8 +43,8 @@ public enum ThingProvider { | |||
| } | |||
| // helper functino for subtractThingMetas | |||
| private static Predicate<ThingMetaData> thingEqual(ThingMetaData other) | |||
| // helper function for subtractThingMetas | |||
| private static Predicate<ThingMetaData> thingEqual(final ThingMetaData other) | |||
| { | |||
| return p -> p.getId() == other.getId(); | |||
| } | |||
| @@ -80,9 +75,12 @@ public enum ThingProvider { | |||
| String resultList = gson.toJson(this.thingMetas); | |||
| try { | |||
| Path filesPath = new Path("result_" + Long.toString(System.currentTimeMillis())); | |||
| System.out.println("File output path: " + filesPath); | |||
| BufferedWriter writer = new BufferedWriter( | |||
| new FileWriter("result_" + Long.toString(System.currentTimeMillis()))); | |||
| new FileWriter(filesPath.toString())); | |||
| writer.write(resultList); | |||
| writer.close(); | |||
| } catch (IOException e) { | |||
| e.printStackTrace(); | |||
| @@ -96,13 +94,13 @@ public enum ThingProvider { | |||
| return thingMetas; | |||
| } | |||
| @Inject | |||
| @Optional | |||
| private void subscribeTopicSourceChanged | |||
| (@UIEventTopic(EventConstants.TOPIC_TAG_RESULT) | |||
| String str) { | |||
| System.out.println("Tag result now."); | |||
| this.tagResult(); | |||
| } | |||
| // @Inject | |||
| // @Optional | |||
| // private void subscribeTopicTagResult | |||
| // (@UIEventTopic(EventConstants.TOPIC_TAG_RESULT) | |||
| // String empty) { | |||
| // System.out.println("TOPIC_TAG_RESULT: Tag result now."); | |||
| // this.tagResult(); | |||
| // } | |||
| } | |||
| @@ -21,10 +21,10 @@ import org.eclipse.swt.events.SelectionAdapter; | |||
| import org.eclipse.swt.events.SelectionEvent; | |||
| 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.Label; | |||
| import org.eclipse.swt.widgets.Layout; | |||
| import xyz.veronie.bgg.result.ResultConfigManager; | |||
| import xyz.veronie.bgg.types.EventConstants; | |||
| @@ -46,13 +46,16 @@ public class BggUserSourceFilter { | |||
| @Inject private IEventBroker eventBroker; | |||
| @Inject private ResultConfigManager configManager; | |||
| private Combo cbUserName; | |||
| public void create(Composite parent, int style) { | |||
| GridLayout filterLayout = new GridLayout(5, false); | |||
| parent.setLayout(filterLayout); | |||
| Composite mainCompo = new Composite(parent, SWT.FILL); | |||
| mainCompo.setLayout(new GridLayout(5, false)); | |||
| mainCompo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); | |||
| Label lblUser = new Label(parent, SWT.LEFT); | |||
| Label lblUser = new Label(mainCompo, SWT.LEFT); | |||
| lblUser.setText("User name: "); | |||
| lblUser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| @@ -69,7 +72,7 @@ public class BggUserSourceFilter { | |||
| // e1.printStackTrace(); | |||
| // } | |||
| Combo cbUserName = new Combo(parent, SWT.DROP_DOWN); | |||
| cbUserName = new Combo(mainCompo, SWT.DROP_DOWN); | |||
| cbUserName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| cbUserName.setText(configManager.getResultConfig().user); | |||
| cbUserName.addSelectionListener(new SelectionAdapter() { | |||
| @@ -90,6 +93,8 @@ public class BggUserSourceFilter { | |||
| } | |||
| }); | |||
| CommonControls.makeEmptySpace(mainCompo, 1); | |||
| // Button btEditUsers = new Button(parent, SWT.PUSH); | |||
| // btEditUsers.setText("edit users"); | |||
| // btEditUsers.setEnabled(false); | |||
| @@ -97,14 +102,12 @@ public class BggUserSourceFilter { | |||
| // btEditUsers.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| // TODO: implement edit users | |||
| CommonControls.makeEmptySpace(parent, 1); | |||
| // choose the thing sub-type | |||
| Label lblSubtype = new Label(parent, SWT.LEFT); | |||
| Label lblSubtype = new Label(mainCompo, SWT.LEFT); | |||
| lblSubtype.setText("Subtypes: "); | |||
| lblSubtype.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false)); | |||
| ComboViewer cbSubtypes = new ComboViewer(parent, SWT.READ_ONLY); | |||
| ComboViewer cbSubtypes = new ComboViewer(mainCompo, SWT.READ_ONLY); | |||
| cbSubtypes.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| cbSubtypes.setContentProvider(ArrayContentProvider.getInstance()); | |||
| List<Subtype> subtypes = new ArrayList<Subtype>(); | |||
| @@ -123,37 +126,42 @@ public class BggUserSourceFilter { | |||
| Label infoLabel = new Label(parent, SWT.LEFT); | |||
| Composite flagsComposite = new Composite(mainCompo, SWT.FILL); | |||
| GridLayout layout = new GridLayout(4,false); | |||
| GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); | |||
| gridData.horizontalSpan = 5; | |||
| flagsComposite.setLayoutData(gridData); | |||
| layout.horizontalSpacing = 15; | |||
| flagsComposite.setLayout(layout); | |||
| Label infoLabel = new Label(flagsComposite, 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 = 5; | |||
| gdInfo.horizontalSpan = 4; | |||
| infoLabel.setLayoutData(gdInfo); | |||
| makeFilter(parent, UserFlag.OWN); | |||
| makeFilter(parent, UserFlag.WTP); | |||
| CommonControls.makeEmptySpace(parent, 1); | |||
| makeFilter(flagsComposite, UserFlag.OWN); | |||
| makeFilter(flagsComposite, UserFlag.WTP); | |||
| makeFilter(parent, UserFlag.PREVIOUSLY_OWNED); | |||
| makeFilter(parent, UserFlag.WTB); | |||
| CommonControls.makeEmptySpace(parent, 1); | |||
| makeFilter(flagsComposite, UserFlag.PREVIOUSLY_OWNED); | |||
| makeFilter(flagsComposite, UserFlag.WTB); | |||
| makeFilter(parent, UserFlag.TRADE); | |||
| makeFilter(parent, UserFlag.WISHLIST); | |||
| CommonControls.makeEmptySpace(parent, 1); | |||
| makeFilter(flagsComposite, UserFlag.TRADE); | |||
| makeFilter(flagsComposite, UserFlag.WISHLIST); | |||
| makeFilter(parent, UserFlag.WANT); | |||
| makeFilter(parent, UserFlag.PREORDERED); | |||
| CommonControls.makeEmptySpace(parent, 1); | |||
| makeFilter(flagsComposite, UserFlag.WANT); | |||
| makeFilter(flagsComposite, UserFlag.PREORDERED); | |||
| makeFilter(parent, UserFlag.RATED); | |||
| makeFilter(parent, UserFlag.COMMENT); | |||
| CommonControls.makeEmptySpace(parent, 1); | |||
| makeFilter(flagsComposite, UserFlag.RATED); | |||
| makeFilter(flagsComposite, UserFlag.COMMENT); | |||
| makeFilter(parent, UserFlag.PLAYED); | |||
| makeFilter(flagsComposite, UserFlag.PLAYED); | |||
| parent.pack(); | |||
| parent.getParent().pack(); | |||
| parent.layout(); | |||
| // flagsComposite.pack(); | |||
| // flagsComposite.getParent().pack(); | |||
| // flagsComposite.layout(); | |||
| mainCompo.pack(); | |||
| mainCompo.layout(true, true); | |||
| } | |||
| @@ -161,7 +169,7 @@ public class BggUserSourceFilter { | |||
| // Filters are tri-state: include iff has flag, include iff it does not have the flag, | |||
| // don't care if it has that flag. | |||
| // TODO: create a three-way toggle button instead. | |||
| private void makeFilter(Composite parent, UserFlag key) { | |||
| private void makeFilter(Composite parent, final UserFlag key) { | |||
| ComboViewer filterCombo = new ComboViewer(parent, SWT.READ_ONLY); | |||
| filterCombo.setContentProvider(ArrayContentProvider.getInstance()); | |||
| @@ -9,7 +9,6 @@ import org.eclipse.e4.core.di.annotations.Creatable; | |||
| import org.eclipse.e4.core.di.annotations.Optional; | |||
| import org.eclipse.e4.core.services.events.IEventBroker; | |||
| import org.eclipse.e4.ui.di.UIEventTopic; | |||
| import org.eclipse.jface.dialogs.MessageDialog; | |||
| import org.eclipse.jface.viewers.ArrayContentProvider; | |||
| import org.eclipse.jface.viewers.ComboViewer; | |||
| import org.eclipse.jface.viewers.ISelectionChangedListener; | |||
| @@ -39,6 +38,7 @@ public class FamilySourceFilter { | |||
| @Inject private IEventBroker eventBroker; | |||
| @Inject private ResultConfigManager configManager; | |||
| private StyledText confLabel; | |||
| private Combo cbFamilyId; | |||
| public void create(Composite parent, int style) { | |||
| GridLayout filterLayout = new GridLayout(2, false); | |||
| @@ -48,7 +48,7 @@ public class FamilySourceFilter { | |||
| lblFamily.setText("Family ID: "); | |||
| lblFamily.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| Combo cbFamilyId = new Combo(parent, SWT.DROP_DOWN); | |||
| cbFamilyId = new Combo(parent, SWT.DROP_DOWN); | |||
| cbFamilyId.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| Integer fid = configManager.getResultConfig().familyId; | |||
| @@ -63,7 +63,7 @@ public class FamilySourceFilter { | |||
| System.out.println("set family id to '" + configManager.getResultConfig().familyId + "'"); | |||
| } | |||
| catch (NumberFormatException ex) { | |||
| MessageDialog.openError(parent.getShell(), "Input error", "FamilyId must be a whole number."); | |||
| eventBroker.send(EventConstants.TOPIC_STATUS, "[ERROR] GeeklistId must be a whole number."); | |||
| } | |||
| System.out.println("set family id to '" + configManager.getResultConfig().familyId + "'"); | |||
| } | |||
| @@ -77,7 +77,7 @@ public class FamilySourceFilter { | |||
| System.out.println("set family id to '" + configManager.getResultConfig().geeklistId + "'"); | |||
| } | |||
| catch (NumberFormatException ex) { | |||
| MessageDialog.openError(parent.getShell(), "Input error", "FamilyId must be a whole number."); | |||
| eventBroker.send(EventConstants.TOPIC_STATUS, "[ERROR] GeeklistId must be a whole number."); | |||
| } | |||
| System.out.println("set family id to '" + configManager.getResultConfig().familyId + "'"); | |||
| } | |||
| @@ -6,7 +6,6 @@ import org.eclipse.e4.core.di.annotations.Creatable; | |||
| import org.eclipse.e4.core.di.annotations.Optional; | |||
| import org.eclipse.e4.core.services.events.IEventBroker; | |||
| import org.eclipse.e4.ui.di.UIEventTopic; | |||
| import org.eclipse.jface.dialogs.MessageDialog; | |||
| import org.eclipse.swt.SWT; | |||
| import org.eclipse.swt.custom.StyledText; | |||
| import org.eclipse.swt.events.FocusEvent; | |||
| @@ -30,6 +29,7 @@ public class GeeklistSourceFilter { | |||
| @Inject private ResultConfigManager configManager; | |||
| private StyledText confLabel; | |||
| private Combo cbGeeklistId; | |||
| public void create(Composite parent, int style) { | |||
| GridLayout filterLayout = new GridLayout(2, false); | |||
| @@ -39,7 +39,7 @@ public class GeeklistSourceFilter { | |||
| lblGeeklist.setText("Geeklist ID: "); | |||
| lblGeeklist.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| Combo cbGeeklistId = new Combo(parent, SWT.DROP_DOWN); | |||
| cbGeeklistId = new Combo(parent, SWT.DROP_DOWN); | |||
| Integer gid = configManager.getResultConfig().geeklistId; | |||
| if(gid != null) { | |||
| cbGeeklistId.setText(Integer.toString(gid)); | |||
| @@ -52,7 +52,7 @@ public class GeeklistSourceFilter { | |||
| System.out.println("set geeklist id to '" + configManager.getResultConfig().geeklistId + "'"); | |||
| } | |||
| catch (NumberFormatException ex) { | |||
| MessageDialog.openError(parent.getShell(), "Input error", "GeeklistId must be a whole number."); | |||
| eventBroker.send(EventConstants.TOPIC_STATUS, "[ERROR] GeeklistId must be a whole number."); | |||
| } | |||
| } | |||
| }); | |||
| @@ -65,7 +65,7 @@ public class GeeklistSourceFilter { | |||
| System.out.println("set geeklist id to '" + configManager.getResultConfig().geeklistId + "'"); | |||
| } | |||
| catch (NumberFormatException ex) { | |||
| MessageDialog.openError(parent.getShell(), "Input error", "GeeklistId must be a whole number."); | |||
| eventBroker.send(EventConstants.TOPIC_STATUS, "[ERROR] GeeklistId must be a whole number."); | |||
| } | |||
| } | |||
| @@ -0,0 +1,23 @@ | |||
| package xyz.veronie.bgg.ui.handlers; | |||
| import org.eclipse.e4.core.di.annotations.CanExecute; | |||
| import org.eclipse.e4.core.di.annotations.Execute; | |||
| import xyz.veronie.bgg.result.ThingProvider; | |||
| public class HandleSaveGamelist { | |||
| @Execute | |||
| public void execute() { | |||
| ThingProvider.INSTANCE.tagResult(); | |||
| } | |||
| @CanExecute | |||
| public boolean canExecute() { | |||
| // TODO | |||
| return true; | |||
| } | |||
| } | |||
| @@ -13,6 +13,8 @@ import org.eclipse.jface.viewers.ColumnLabelProvider; | |||
| import org.eclipse.jface.viewers.TableViewer; | |||
| import org.eclipse.jface.viewers.TableViewerColumn; | |||
| import org.eclipse.swt.SWT; | |||
| import org.eclipse.swt.events.SelectionAdapter; | |||
| import org.eclipse.swt.events.SelectionEvent; | |||
| import org.eclipse.swt.layout.GridData; | |||
| import org.eclipse.swt.layout.GridLayout; | |||
| import org.eclipse.swt.widgets.Button; | |||
| @@ -29,8 +31,6 @@ public class BggResultPart { | |||
| private TableViewer viewer; | |||
| private Label statsLabel; | |||
| @Inject private IEventBroker eventBroker; | |||
| @PostConstruct | |||
| public void createControls(Composite parent) { | |||
| Composite main = new Composite(parent, SWT.FILL); | |||
| @@ -42,14 +42,12 @@ public class BggResultPart { | |||
| createViewer(main); | |||
| statsLabel = new Label(main, SWT.FILL); | |||
| statsLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| statsLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); | |||
| statsLabel.setText("0 items"); | |||
| Button tagResultButton = new Button(main, SWT.PUSH); | |||
| tagResultButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| tagResultButton.addListener(SWT.SELECTED, event -> { | |||
| eventBroker.post(EventConstants.TOPIC_TAG_RESULT, ""); | |||
| }); | |||
| } | |||
| @@ -0,0 +1,225 @@ | |||
| package xyz.veronie.bgg.ui.parts; | |||
| import javax.annotation.PostConstruct; | |||
| import org.eclipse.core.runtime.IProgressMonitor; | |||
| import org.eclipse.core.runtime.jobs.Job; | |||
| import org.eclipse.core.runtime.jobs.ProgressProvider; | |||
| import org.eclipse.jface.viewers.ComboViewer; | |||
| import org.eclipse.swt.SWT; | |||
| import org.eclipse.swt.events.SelectionAdapter; | |||
| import org.eclipse.swt.events.SelectionEvent; | |||
| 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.Group; | |||
| import org.eclipse.swt.widgets.Label; | |||
| import org.eclipse.swt.widgets.ProgressBar; | |||
| import xyz.veronie.bgg.ui.helpers.CommonControls; | |||
| import xyz.veronie.bgg.ui.result.DownloadProgressMonitor; | |||
| public class DownloadThingDetailsPart { | |||
| private DownloadProgressMonitor monitor; | |||
| private Button extendedInfoCheck; | |||
| private Button downloadAllPlaysCheck; | |||
| @PostConstruct | |||
| public void createControls(Composite parent) { | |||
| Composite main = new Composite(parent, SWT.FILL); | |||
| main.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| GridLayout layout = new GridLayout(2, false); | |||
| main.setLayout(layout); | |||
| Composite loadGamesComposite = new Composite(main, SWT.FILL); | |||
| loadGamesComposite.setLayout(new GridLayout(1, false)); | |||
| loadGamesComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); | |||
| loadGamesComposite.setBackground(main.getDisplay().getSystemColor(SWT.COLOR_WHITE)); | |||
| createLoadGamesControls(loadGamesComposite); | |||
| Composite loadOptionsComposite = new Composite(main, SWT.FILL); | |||
| loadOptionsComposite.setLayout(new GridLayout(1, false)); | |||
| loadOptionsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); | |||
| loadOptionsComposite.setBackground(main.getDisplay().getSystemColor(SWT.COLOR_WHITE)); | |||
| createLoadOptionsControls(loadOptionsComposite); | |||
| Composite runNanDeckComposite = new Composite(main, SWT.FILL); | |||
| runNanDeckComposite.setLayout(new GridLayout(1, false)); | |||
| runNanDeckComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); | |||
| runNanDeckComposite.setBackground(main.getDisplay().getSystemColor(SWT.COLOR_WHITE)); | |||
| createRunNanDeckControls(runNanDeckComposite); | |||
| Composite nanDeckOptionsComposite = new Composite(main, SWT.FILL); | |||
| nanDeckOptionsComposite.setLayout(new GridLayout(1, false)); | |||
| nanDeckOptionsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); | |||
| nanDeckOptionsComposite.setBackground(main.getDisplay().getSystemColor(SWT.COLOR_WHITE)); | |||
| createNandeckOptionsControl(nanDeckOptionsComposite); | |||
| } | |||
| private void createNandeckOptionsControl(Composite compo) { | |||
| // Combo with ("Wait for user input", "Create PDF", "Print on default printer", "Save BMP images", | |||
| // "Save JPG images", "Save PNG images", Save GIF images", "Save GIFa images"); | |||
| } | |||
| private void createLoadOptionsControls(Composite compo) { | |||
| Group optionsGroup = new Group(compo, SWT.SHADOW_ETCHED_IN); | |||
| GridLayout layout = new GridLayout(3, false); | |||
| layout.horizontalSpacing = 15; | |||
| optionsGroup.setLayout(layout); | |||
| optionsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); | |||
| optionsGroup.setText("Download options"); | |||
| Label gamesLbl = new Label(optionsGroup, SWT.LEFT); | |||
| gamesLbl.setText("Games"); | |||
| ComboViewer gamesCombo = new ComboViewer(optionsGroup); | |||
| CommonControls.makeEmptySpace(optionsGroup, 1); | |||
| Label resolutionLbl = new Label(optionsGroup, SWT.LEFT); | |||
| resolutionLbl.setText("Resolution"); | |||
| ComboViewer resolutionCombo = new ComboViewer(optionsGroup); | |||
| CommonControls.makeEmptySpace(optionsGroup, 1); | |||
| Label imagesLbl = new Label(optionsGroup, SWT.LEFT); | |||
| imagesLbl.setText("Images"); | |||
| ComboViewer imagesCombo = new ComboViewer(optionsGroup); | |||
| CommonControls.makeEmptySpace(optionsGroup, 1); | |||
| Button onlyNewCheck = new Button(optionsGroup, SWT.CHECK); | |||
| onlyNewCheck.setText("Only new"); | |||
| Button usePersNamesCheck = new Button(optionsGroup, SWT.CHECK); | |||
| usePersNamesCheck.setText("Use pers. names"); | |||
| usePersNamesCheck.setEnabled(false); | |||
| Button only1DesignerCheck = new Button(optionsGroup, SWT.CHECK); | |||
| only1DesignerCheck.setText("Only one designer"); | |||
| only1DesignerCheck.setEnabled(false); | |||
| Button withDescCheck = new Button(optionsGroup, SWT.CHECK); | |||
| withDescCheck.setText("With description"); | |||
| Button usePersImagesCheck = new Button(optionsGroup, SWT.CHECK); | |||
| usePersImagesCheck.setText("Use pers. images"); | |||
| usePersImagesCheck.setEnabled(false); | |||
| Button only1PublisherCheck = new Button(optionsGroup, SWT.CHECK); | |||
| only1PublisherCheck.setText("Only one publisher"); | |||
| only1PublisherCheck.setEnabled(false); | |||
| Button limitDescCheck = new Button(optionsGroup, SWT.CHECK); | |||
| limitDescCheck.setText("Limit description"); | |||
| Button useRecBestInfoCheck = new Button(optionsGroup, SWT.CHECK); | |||
| useRecBestInfoCheck.setText("Use rec./best info"); | |||
| useRecBestInfoCheck.setEnabled(false); | |||
| Button only1ArtistCheck = new Button(optionsGroup, SWT.CHECK); | |||
| only1ArtistCheck.setText("Only one artist"); | |||
| only1ArtistCheck.setEnabled(false); | |||
| Button downloadVotesCheck = new Button(optionsGroup, SWT.CHECK); | |||
| downloadVotesCheck.setText("Download votes"); | |||
| downloadVotesCheck.setEnabled(false); | |||
| downloadVotesCheck.addSelectionListener(new SelectionAdapter() { | |||
| @Override | |||
| public void widgetSelected(SelectionEvent e) { | |||
| extendedInfoCheck.setEnabled(true); | |||
| } | |||
| }); | |||
| Button brnDetailCheck = new Button(optionsGroup, SWT.CHECK); | |||
| brnDetailCheck.setText("B/R/N detail"); | |||
| brnDetailCheck.setEnabled(false); | |||
| Button reloadDataCheck = new Button(optionsGroup, SWT.CHECK); | |||
| reloadDataCheck.setText("Reload data"); | |||
| reloadDataCheck.setEnabled(false); | |||
| extendedInfoCheck = new Button(optionsGroup, SWT.CHECK); | |||
| extendedInfoCheck.setText(" Extended info"); | |||
| extendedInfoCheck.setEnabled(false); // enabled when download votes is checked | |||
| Button downloadPlaysCheck = new Button(optionsGroup, SWT.CHECK); | |||
| downloadPlaysCheck.setText("Download plays"); | |||
| downloadPlaysCheck.setEnabled(false); | |||
| downloadPlaysCheck.addSelectionListener(new SelectionAdapter() { | |||
| @Override | |||
| public void widgetSelected(SelectionEvent e) { | |||
| downloadAllPlaysCheck.setEnabled(true); | |||
| } | |||
| }); | |||
| Button reloadImagesCheck = new Button(optionsGroup, SWT.CHECK); | |||
| reloadImagesCheck.setText("Reload images"); | |||
| reloadImagesCheck.setEnabled(false); | |||
| Button downloadLangCheck = new Button(optionsGroup, SWT.CHECK); | |||
| downloadLangCheck.setText("Download lang."); | |||
| downloadLangCheck.setEnabled(false); | |||
| downloadAllPlaysCheck = new Button(optionsGroup, SWT.CHECK); | |||
| downloadAllPlaysCheck.setText(" Download plays (all)"); | |||
| downloadAllPlaysCheck.setEnabled(false); // enabled when download plays checked | |||
| Button ReloadQRCodesCheck = new Button(optionsGroup, SWT.CHECK); | |||
| ReloadQRCodesCheck.setText("Reload QR codes"); | |||
| ReloadQRCodesCheck.setEnabled(false); | |||
| Button namesImgCheck = new Button(optionsGroup, SWT.CHECK); | |||
| namesImgCheck.setText("Names in images"); | |||
| namesImgCheck.setEnabled(false); | |||
| Button useQrCodesCheck = new Button(optionsGroup, SWT.CHECK); | |||
| useQrCodesCheck.setText("Use QR codes"); | |||
| useQrCodesCheck.setEnabled(false); | |||
| } | |||
| private void createRunNanDeckControls(Composite compo) { | |||
| Button runNandeckBtn = new Button(compo, SWT.LEFT); | |||
| runNandeckBtn.setText("Run nanDeck"); | |||
| runNandeckBtn.addSelectionListener(new SelectionAdapter() { | |||
| }); | |||
| } | |||
| private void createLoadGamesControls(Composite compo) { | |||
| Button loadGamesBtn = new Button(compo, SWT.LEFT); | |||
| loadGamesBtn.setText("Load games"); | |||
| loadGamesBtn.addSelectionListener(new SelectionAdapter() { | |||
| }); | |||
| ProgressBar progressBar = new ProgressBar(compo, SWT.SMOOTH); | |||
| progressBar.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); | |||
| monitor = new DownloadProgressMonitor(); | |||
| Job.getJobManager().setProgressProvider(new ProgressProvider() { | |||
| @Override | |||
| public IProgressMonitor createMonitor(Job job) { | |||
| return monitor.addJob(job); | |||
| } | |||
| }); | |||
| } | |||
| } | |||
| @@ -1,22 +0,0 @@ | |||
| package xyz.veronie.bgg.ui.parts; | |||
| import javax.annotation.PostConstruct; | |||
| import org.eclipse.swt.SWT; | |||
| import org.eclipse.swt.layout.GridData; | |||
| import org.eclipse.swt.layout.GridLayout; | |||
| import org.eclipse.swt.widgets.Composite; | |||
| public class LoadThingDetailsPart { | |||
| @PostConstruct | |||
| public void createControls(Composite parent) { | |||
| Composite main = new Composite(parent, SWT.FILL); | |||
| main.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| GridLayout layout = new GridLayout(5, false); | |||
| main.setLayout(layout); | |||
| } | |||
| } | |||
| @@ -7,6 +7,7 @@ import javax.annotation.PostConstruct; | |||
| import javax.inject.Inject; | |||
| import org.eclipse.e4.core.services.events.IEventBroker; | |||
| import org.eclipse.e4.ui.workbench.modeling.EPartService; | |||
| import org.eclipse.jface.dialogs.MessageDialog; | |||
| import org.eclipse.jface.viewers.ArrayContentProvider; | |||
| import org.eclipse.jface.viewers.ComboViewer; | |||
| @@ -34,7 +35,6 @@ import xyz.veronie.bgg.result.ThingProvider; | |||
| import xyz.veronie.bgg.types.EventConstants; | |||
| import xyz.veronie.bgg.types.ResultAction; | |||
| import xyz.veronie.bgg.types.SourceFilter; | |||
| import xyz.veronie.bgg.types.Subtype; | |||
| import xyz.veronie.bgg.ui.filters.AgeSourceFilter; | |||
| import xyz.veronie.bgg.ui.filters.BggUserSourceFilter; | |||
| import xyz.veronie.bgg.ui.filters.FamilySourceFilter; | |||
| @@ -48,7 +48,10 @@ import xyz.veronie.bgg.ui.helpers.CommonControls; | |||
| /// 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 { | |||
| public class PreparePart { | |||
| @Inject | |||
| EPartService partService; | |||
| @Inject | |||
| private ResultConfigManager configManager; | |||
| @@ -64,15 +67,14 @@ public class LoadFromBggPart { | |||
| @Inject private YearSourceFilter yearSourceFilter; | |||
| @Inject private SearchSourceFilter searchSourceFilter; | |||
| @Inject private BggApi bggApi; | |||
| private Composite mainComposite; | |||
| @PostConstruct | |||
| public void createControls(Composite parent) { | |||
| Composite main = new Composite(parent, SWT.FILL); | |||
| main.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| GridLayout layout = new GridLayout(5, false); | |||
| main.setLayout(layout); | |||
| mainComposite = new Composite(parent, SWT.FILL); | |||
| mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); | |||
| mainComposite.setLayout(new GridLayout(1, false)); | |||
| // // contains configuration options for download of the bgg thing ID list | |||
| // Group dlConfigGroup = new Group(main, SWT.SHADOW_ETCHED_IN); | |||
| @@ -82,12 +84,15 @@ public class LoadFromBggPart { | |||
| // GridLayout layoutG = new GridLayout(2, false); | |||
| // dlConfigGroup.setLayout(layoutG); | |||
| Label lblSource = new Label(main, SWT.LEFT); | |||
| Composite sourceSelectCompo = new Composite(mainComposite, SWT.FILL); | |||
| sourceSelectCompo.setLayout(new GridLayout(2, false)); | |||
| Label lblSource = new Label(sourceSelectCompo, SWT.LEFT); | |||
| lblSource.setText("Source: "); | |||
| lblSource.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false)); | |||
| // choose the bgg data source | |||
| ComboViewer cbSource = new ComboViewer(main, SWT.READ_ONLY); | |||
| ComboViewer cbSource = new ComboViewer(sourceSelectCompo, SWT.READ_ONLY); | |||
| cbSource.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); | |||
| cbSource.setContentProvider(ArrayContentProvider.getInstance()); | |||
| List<SourceFilter> sources = new ArrayList<SourceFilter>(); | |||
| @@ -99,20 +104,14 @@ public class LoadFromBggPart { | |||
| cbSource.setSelection(new StructuredSelection(configManager.getResultConfig().source)); | |||
| // listener is configured further below | |||
| CommonControls.makeEmptySpace(main, 3); | |||
| CommonControls.makeEmptySpace(mainComposite, 2); | |||
| // area to display filter controls | |||
| // next row: | |||
| // area to display filter controls in | |||
| Group gFilters = new Group(main, SWT.SHADOW_ETCHED_IN); | |||
| Group gFilters = new Group(mainComposite, SWT.SHADOW_ETCHED_IN); | |||
| gFilters.setText(""); | |||
| GridData gdf = new GridData(SWT.FILL, SWT.FILL, false, false); | |||
| gdf.horizontalSpan = 5; | |||
| gFilters.setLayoutData(gdf); | |||
| gFilters.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); | |||
| showFilter(gFilters, (IStructuredSelection)cbSource.getSelection()); // set content to initial selection | |||
| cbSource.addSelectionChangedListener(new ISelectionChangedListener() { // later, its content will be set via the dropdown | |||
| @@ -127,16 +126,14 @@ public class LoadFromBggPart { | |||
| }); | |||
| // next row: | |||
| CommonControls.makeEmptySpace(main, 5); | |||
| // next row | |||
| Composite fetchCompo = new Composite(mainComposite, SWT.FILL); | |||
| fetchCompo.setLayout(new GridLayout(4, false)); | |||
| // choose action on result list | |||
| Button btDownload = new Button(main, SWT.PUSH); | |||
| Button btDownload = new Button(fetchCompo, SWT.PUSH); | |||
| GridData gd = new GridData(SWT.LEFT, SWT.FILL, false, false); | |||
| gd.horizontalSpan = 2; | |||
| btDownload.setLayoutData(gd); | |||
| btDownload.setText("Fetch"); | |||
| btDownload.addSelectionListener(new SelectionAdapter() { | |||
| @@ -150,7 +147,7 @@ public class LoadFromBggPart { | |||
| if(selection.getFirstElement() == SourceFilter.BGG_USER) { | |||
| String user = resultConfig.user; | |||
| if(user == null || user.isEmpty()) { | |||
| MessageDialog.openError(main.getShell(), "", "Please enter a user name."); | |||
| MessageDialog.openError(mainComposite.getShell(), "", "Please enter a user name."); | |||
| return; | |||
| } else { | |||
| eventBroker.send(EventConstants.TOPIC_STATUS, "Fetching " + selection.getFirstElement().toString() + " '" + user + "'..."); | |||
| @@ -159,14 +156,14 @@ public class LoadFromBggPart { | |||
| useThingsOnResult(thingMetas); | |||
| } | |||
| catch(IllegalArgumentException ex) { | |||
| MessageDialog.openError(main.getShell(), "", ex.getMessage()); | |||
| MessageDialog.openError(mainComposite.getShell(), "", ex.getMessage()); | |||
| } | |||
| } | |||
| } else if(selection.getFirstElement() == SourceFilter.GEEKLIST) { | |||
| Integer geeklistId = resultConfig.geeklistId; | |||
| if(geeklistId == null) { | |||
| MessageDialog.openError(main.getShell(), "", "Please enter a geeklist id."); | |||
| MessageDialog.openError(mainComposite.getShell(), "", "Please enter a geeklist id."); | |||
| return; | |||
| } else { | |||
| eventBroker.send(EventConstants.TOPIC_STATUS, "Fetching for geeklist id '" + geeklistId + "'"); | |||
| @@ -175,13 +172,13 @@ public class LoadFromBggPart { | |||
| useThingsOnResult(thingMetas); | |||
| } | |||
| catch(IllegalArgumentException ex) { | |||
| MessageDialog.openError(main.getShell(), "", ex.getMessage()); | |||
| MessageDialog.openError(mainComposite.getShell(), "", ex.getMessage()); | |||
| } | |||
| } | |||
| } else if(selection.getFirstElement() == SourceFilter.FAMILY) { | |||
| Integer familyId = resultConfig.familyId; | |||
| if(familyId == null) { | |||
| MessageDialog.openError(main.getShell(), "", "Please enter a family id."); | |||
| MessageDialog.openError(mainComposite.getShell(), "", "Please enter a family id."); | |||
| return; | |||
| } else { | |||
| eventBroker.send(EventConstants.TOPIC_STATUS, "Fetching for family id '" + familyId + "'"); | |||
| @@ -190,7 +187,7 @@ public class LoadFromBggPart { | |||
| useThingsOnResult(thingMetas); | |||
| } | |||
| catch(IllegalArgumentException ex) { | |||
| MessageDialog.openError(main.getShell(), "", ex.getMessage()); | |||
| MessageDialog.openError(mainComposite.getShell(), "", ex.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| @@ -217,11 +214,11 @@ public class LoadFromBggPart { | |||
| }); | |||
| Label lblAct = new Label(main, SWT.LEFT); | |||
| Label lblAct = new Label(fetchCompo, SWT.LEFT); | |||
| lblAct.setText("and"); | |||
| lblAct.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, false)); | |||
| ComboViewer cbAct = new ComboViewer(main, SWT.READ_ONLY); | |||
| ComboViewer cbAct = new ComboViewer(fetchCompo, SWT.READ_ONLY); | |||
| GridData gdact = new GridData(SWT.FILL, SWT.FILL, false, false); | |||
| cbAct.getCombo().setLayoutData(gdact); | |||
| cbAct.setContentProvider(ArrayContentProvider.getInstance()); | |||
| @@ -240,29 +237,18 @@ public class LoadFromBggPart { | |||
| }); | |||
| Label toResultLabel = new Label(main, SWT.LEFT); | |||
| Label toResultLabel = new Label(fetchCompo, SWT.LEFT); | |||
| toResultLabel.setText("result"); | |||
| toResultLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| // // Start retrieval when download button is pushed | |||
| // // TODO: how do I locate icons? | |||
| // Button btDownload = new Button(main, SWT.PUSH); | |||
| // 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"); | |||
| // } | |||
| main.pack(); | |||
| mainComposite.pack(); | |||
| mainComposite.layout(); | |||
| } | |||
| /// show different filter controls depending on selection in cbSource ComboViewer | |||
| public void showFilter(Composite parent, IStructuredSelection selection) { | |||
| private void showFilter(Composite parent, IStructuredSelection selection) { | |||
| SourceFilter elem = (SourceFilter) selection.getFirstElement(); | |||
| // clean up | |||
| @@ -300,6 +286,9 @@ public class LoadFromBggPart { | |||
| System.out.println("construct " + elem + " (not implemented yet, try another one)"); | |||
| } | |||
| parent.pack(); | |||
| mainComposite.pack(); | |||
| mainComposite.layout(true, true); | |||
| } | |||
| @@ -42,12 +42,13 @@ public class StatusBar { | |||
| @Inject | |||
| @Optional | |||
| private void subscribeTopicSourceChanged | |||
| private void subscribeTopicStatusChanged | |||
| (@UIEventTopic(EventConstants.TOPIC_STATUS) | |||
| String text) { | |||
| statusLabel.setText(text); | |||
| statusLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); | |||
| statusLabel.getParent().pack(); | |||
| System.out.println("Status: " + text); | |||
| } | |||
| } | |||
| @@ -0,0 +1,14 @@ | |||
| package xyz.veronie.bgg.ui.result; | |||
| import org.eclipse.core.runtime.IProgressMonitor; | |||
| import org.eclipse.core.runtime.NullProgressMonitor; | |||
| import org.eclipse.core.runtime.jobs.Job; | |||
| public class DownloadProgressMonitor extends NullProgressMonitor { | |||
| public IProgressMonitor addJob(Job job) { | |||
| // TODO Auto-generated method stub | |||
| return null; | |||
| } | |||
| } | |||