| @@ -11,6 +11,7 @@ | |||||
| <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: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"> | <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"/> | <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"/> | ||||
| <children xsi:type="menu:DirectToolItem" xmi:id="_VeUlQFZdEeu8-NdCRpPGXA" elementId="xyz.veronie.bgg.ui.directtoolitem.openlist" label="open list" iconURI="platform:/plugin/xyz.veronie.bgg.ui/icons/folder-symbol.png"/> | |||||
| </toolbar> | </toolbar> | ||||
| </children> | </children> | ||||
| </children> | </children> | ||||
| @@ -0,0 +1,38 @@ | |||||
| package xyz.veronie.bgg.localdb; | |||||
| import java.io.File; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| import xyz.veronie.bgg.result.ThingMetaData; | |||||
| public class LocalDbAdapterService { | |||||
| private SqliteController sqliteController; | |||||
| public LocalDbAdapterService() { | |||||
| initDb(); | |||||
| } | |||||
| private void initDb() { | |||||
| File dbFile = new File(SqliteController.DB_PATH); | |||||
| if(!dbFile.exists()) { | |||||
| SqliteController.getInstance().createSchema(); | |||||
| } | |||||
| sqliteController = SqliteController.getInstance(); | |||||
| } | |||||
| /// add a list of things with the given name | |||||
| public void storeThingList(List<ThingMetaData> things, String name) { | |||||
| sqliteController.openThingList(name); | |||||
| sqliteController.addToThingList(name, things); | |||||
| } | |||||
| /// retrieve a list of things with the given name | |||||
| public List<ThingMetaData> retrieveThingList(String name) { | |||||
| // TODO: implement retrieve thing list | |||||
| return new ArrayList<ThingMetaData>(); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,134 @@ | |||||
| package xyz.veronie.bgg.localdb; | |||||
| import java.sql.Connection; | |||||
| import java.sql.DriverManager; | |||||
| import java.sql.PreparedStatement; | |||||
| import java.sql.ResultSet; | |||||
| import java.sql.SQLException; | |||||
| import java.sql.Statement; | |||||
| import java.util.List; | |||||
| import xyz.veronie.bgg.result.ThingMetaData; | |||||
| public class SqliteController { | |||||
| private static final SqliteController dbcontroller = new SqliteController(); | |||||
| private static Connection connection; | |||||
| public static final String DB_PATH = System.getProperty("user.home") + "/" + "bggtool.db"; | |||||
| static { | |||||
| try { | |||||
| Class.forName("org.sqlite.JDBC"); | |||||
| } catch (ClassNotFoundException e) { | |||||
| System.err.println("Error while loading JDBC driver"); | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| private SqliteController() { | |||||
| initDBConnection(); | |||||
| } | |||||
| public static SqliteController getInstance() { | |||||
| return dbcontroller; | |||||
| } | |||||
| private void initDBConnection() { | |||||
| try { | |||||
| if (connection != null) | |||||
| return; | |||||
| System.out.println("Creating Connection to Database..."); | |||||
| String filename = System.getProperty("user.home") + "/bggtool.db"; | |||||
| connection = DriverManager.getConnection("jdbc:sqlite:" + filename); | |||||
| if (!connection.isClosed()) | |||||
| System.out.println("...Connection established"); | |||||
| } catch (SQLException e) { | |||||
| throw new RuntimeException(e); | |||||
| } | |||||
| Runtime.getRuntime().addShutdownHook(new Thread() { | |||||
| public void run() { | |||||
| try { | |||||
| if (!connection.isClosed() && connection != null) { | |||||
| connection.close(); | |||||
| if (connection.isClosed()) | |||||
| System.out.println("Connection to Database closed"); | |||||
| } | |||||
| } catch (SQLException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| }); | |||||
| } | |||||
| public void createSchema() { | |||||
| try { | |||||
| Statement stmt = connection.createStatement(); | |||||
| stmt.executeUpdate("DROP TABLE IF EXISTS Thing;"); | |||||
| stmt.executeUpdate("DROP TABLE IF EXISTS ThingList"); | |||||
| stmt.executeUpdate("DROP TABLE IF EXISTS ThingListToThing"); | |||||
| stmt.executeUpdate("CREATE TABLE Thing (ThingId INTEGER PRIMARY KEY, Name, ImgUrl, ThumbUrl, Comment, NumPlays);"); | |||||
| stmt.executeUpdate("CREATE TABLE ThingList (ListId INTEGER PRIMARY KEY, Name) ON DELETE CASCADE;"); | |||||
| stmt.executeUpdate("CREATE UNIQUE INDEX idx1 ON ThingList(Name)"); | |||||
| stmt.executeUpdate("CREATE TABLE ThingListToThing (ListId, ThingId, FOREIGN KEY (ListId) REFERENCES ThingList(ListId), FOREIGN KEY (ThingId) REFERENCES Thing(ThingId));"); | |||||
| stmt.executeUpdate("CREATE UNIQUE INDEX idx2 ON ThingListToThing(ListId, ThingId)"); | |||||
| } catch (SQLException e) { | |||||
| System.err.println("Couldn't create Schema"); | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| public void openThingList(String name) { | |||||
| try { | |||||
| Statement stmt = connection.createStatement(); | |||||
| // insert new thing list if one with that name does not exist already | |||||
| stmt.executeQuery("INSERT INTO ThingList (name) VALUES ('" + name + "');"); | |||||
| } catch (SQLException e) { | |||||
| System.err.println("Couldn't add to thing list with handle " + name); | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| public void addToThingList(String name, List<ThingMetaData> things) { | |||||
| try { | |||||
| Statement stmt = connection.createStatement(); | |||||
| ResultSet res = stmt.executeQuery("SELECT ListId from ThingList where name = '" + name + "'"); | |||||
| int listId = res.getInt(0); | |||||
| PreparedStatement thingStatement = connection | |||||
| .prepareStatement("INSERT INTO Thing VALUES (?, ?, ?, ?, ?, ?) ON CONFLICT REPLACE;"); | |||||
| PreparedStatement listToThingStatement = connection | |||||
| .prepareStatement("INSERT INTO ThingListToThing VALUES (?, ?)"); | |||||
| for (ThingMetaData thing : things) { | |||||
| thingStatement.setInt(1, thing.getId()); | |||||
| thingStatement.setString(2, thing.getName()); | |||||
| thingStatement.setString(3, thing.getImgURL()); | |||||
| thingStatement.setString(4, thing.getThumbURL()); | |||||
| thingStatement.setString(5, thing.getComment()); | |||||
| thingStatement.setInt(6, thing.getNumPlays()); | |||||
| thingStatement.addBatch(); | |||||
| // get generated id | |||||
| ResultSet keys = thingStatement.getGeneratedKeys(); | |||||
| int thingId = keys.getInt(0); | |||||
| listToThingStatement.setInt(0, listId); | |||||
| listToThingStatement.setInt(1, thingId); | |||||
| listToThingStatement.addBatch(); | |||||
| } | |||||
| connection.setAutoCommit(false); | |||||
| thingStatement.executeBatch(); | |||||
| connection.setAutoCommit(true); | |||||
| } catch (SQLException e) { | |||||
| System.err.println("Couldn't add to thing list with handle " + name); | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,24 +1,29 @@ | |||||
| package xyz.veronie.bgg.result; | package xyz.veronie.bgg.result; | ||||
| import java.io.BufferedWriter; | |||||
| import java.io.FileWriter; | |||||
| import java.io.IOException; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.function.Predicate; | import java.util.function.Predicate; | ||||
| import xyz.veronie.bgg.result.ThingMetaData; | |||||
| import org.eclipse.core.runtime.Path; | |||||
| import javax.annotation.PostConstruct; | |||||
| import javax.inject.Singleton; | |||||
| //import com.google.gson.Gson; | |||||
| import org.eclipse.e4.core.di.annotations.Creatable; | |||||
| public enum ThingProvider { | |||||
| INSTANCE; | |||||
| import xyz.veronie.bgg.localdb.LocalDbAdapterService; | |||||
| @Creatable | |||||
| @Singleton | |||||
| public class ThingProvider { | |||||
| private LocalDbAdapterService localDbAdapterService; | |||||
| /// list of things. Each ID is expected to exist exactly once. | /// list of things. Each ID is expected to exist exactly once. | ||||
| private List<ThingMetaData> thingMetas; | private List<ThingMetaData> thingMetas; | ||||
| public ThingProvider() {} | |||||
| private ThingProvider() { | |||||
| @PostConstruct | |||||
| public void init() { | |||||
| localDbAdapterService = new LocalDbAdapterService(); | |||||
| thingMetas = new ArrayList<ThingMetaData>(); | thingMetas = new ArrayList<ThingMetaData>(); | ||||
| } | } | ||||
| @@ -69,23 +74,9 @@ public enum ThingProvider { | |||||
| } | } | ||||
| } | } | ||||
| /// create a tag of the current list | |||||
| public void tagResult() { | |||||
| // Gson gson = new Gson(); | |||||
| // 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(filesPath.toString())); | |||||
| // writer.write(resultList); | |||||
| writer.close(); | |||||
| } catch (IOException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| /// store current list in DB | |||||
| public void storeList() { | |||||
| localDbAdapterService.storeThingList(this.thingMetas, "TestList"); | |||||
| } | } | ||||
| @@ -1,6 +1,8 @@ | |||||
| package xyz.veronie.bgg.ui.handlers; | package xyz.veronie.bgg.ui.handlers; | ||||
| import javax.inject.Inject; | |||||
| import org.eclipse.e4.core.di.annotations.CanExecute; | import org.eclipse.e4.core.di.annotations.CanExecute; | ||||
| import org.eclipse.e4.core.di.annotations.Execute; | import org.eclipse.e4.core.di.annotations.Execute; | ||||
| @@ -8,15 +10,17 @@ import xyz.veronie.bgg.result.ThingProvider; | |||||
| public class HandleSaveGamelist { | public class HandleSaveGamelist { | ||||
| @Inject | |||||
| ThingProvider thingProvider; | |||||
| @Execute | @Execute | ||||
| public void execute() { | public void execute() { | ||||
| ThingProvider.INSTANCE.tagResult(); | |||||
| thingProvider.storeList(); | |||||
| } | } | ||||
| @CanExecute | @CanExecute | ||||
| public boolean canExecute() { | public boolean canExecute() { | ||||
| // TODO | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -6,18 +6,14 @@ import javax.annotation.PostConstruct; | |||||
| import javax.inject.Inject; | import javax.inject.Inject; | ||||
| import org.eclipse.e4.core.di.annotations.Optional; | 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.e4.ui.di.UIEventTopic; | ||||
| import org.eclipse.jface.viewers.ArrayContentProvider; | import org.eclipse.jface.viewers.ArrayContentProvider; | ||||
| import org.eclipse.jface.viewers.ColumnLabelProvider; | import org.eclipse.jface.viewers.ColumnLabelProvider; | ||||
| import org.eclipse.jface.viewers.TableViewer; | import org.eclipse.jface.viewers.TableViewer; | ||||
| import org.eclipse.jface.viewers.TableViewerColumn; | import org.eclipse.jface.viewers.TableViewerColumn; | ||||
| import org.eclipse.swt.SWT; | 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.GridData; | ||||
| import org.eclipse.swt.layout.GridLayout; | import org.eclipse.swt.layout.GridLayout; | ||||
| import org.eclipse.swt.widgets.Button; | |||||
| import org.eclipse.swt.widgets.Composite; | import org.eclipse.swt.widgets.Composite; | ||||
| import org.eclipse.swt.widgets.Label; | import org.eclipse.swt.widgets.Label; | ||||
| import org.eclipse.swt.widgets.Table; | import org.eclipse.swt.widgets.Table; | ||||
| @@ -31,6 +27,9 @@ public class BggResultPart { | |||||
| private TableViewer viewer; | private TableViewer viewer; | ||||
| private Label statsLabel; | private Label statsLabel; | ||||
| @Inject | |||||
| private ThingProvider thingProvider; | |||||
| @PostConstruct | @PostConstruct | ||||
| public void createControls(Composite parent) { | public void createControls(Composite parent) { | ||||
| Composite main = new Composite(parent, SWT.FILL); | Composite main = new Composite(parent, SWT.FILL); | ||||
| @@ -62,7 +61,7 @@ public class BggResultPart { | |||||
| viewer.setContentProvider(new ArrayContentProvider()); | viewer.setContentProvider(new ArrayContentProvider()); | ||||
| // Get the content for the viewer, setInput will call getElements in the | // Get the content for the viewer, setInput will call getElements in the | ||||
| // contentProvider | // contentProvider | ||||
| viewer.setInput(ThingProvider.INSTANCE.getThingMetas()); | |||||
| viewer.setInput(thingProvider.getThingMetas()); | |||||
| // make the selection available to other views | // make the selection available to other views | ||||
| // TODO: getSite().setSelectionProvider(viewer); | // TODO: getSite().setSelectionProvider(viewer); | ||||
| // Set the sorter for the table | // Set the sorter for the table | ||||
| @@ -125,7 +124,7 @@ public class BggResultPart { | |||||
| (@UIEventTopic(EventConstants.TOPIC_RESULT_CHANGED) | (@UIEventTopic(EventConstants.TOPIC_RESULT_CHANGED) | ||||
| String empty) { | String empty) { | ||||
| System.out.println("TOPIC_RESULT_CHANGED"); | System.out.println("TOPIC_RESULT_CHANGED"); | ||||
| List<ThingMetaData> thingMetas = ThingProvider.INSTANCE.getThingMetas(); | |||||
| List<ThingMetaData> thingMetas = thingProvider.getThingMetas(); | |||||
| viewer.setInput(thingMetas); | viewer.setInput(thingMetas); | ||||
| viewer.refresh(); | viewer.refresh(); | ||||
| @@ -92,103 +92,103 @@ public class DownloadThingDetailsPart { | |||||
| 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); | |||||
| // 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); | |||||
| } | } | ||||
| @@ -56,7 +56,11 @@ public class PreparePart { | |||||
| @Inject | @Inject | ||||
| private ResultConfigManager configManager; | private ResultConfigManager configManager; | ||||
| @Inject private IEventBroker eventBroker; | |||||
| @Inject | |||||
| private IEventBroker eventBroker; | |||||
| @Inject | |||||
| private ThingProvider thingProvider; | |||||
| // inject all source filter composites | // inject all source filter composites | ||||
| @Inject private BggUserSourceFilter bggUserSourceFilter; | @Inject private BggUserSourceFilter bggUserSourceFilter; | ||||
| @@ -196,16 +200,16 @@ public class PreparePart { | |||||
| private void useThingsOnResult(ArrayList<ThingMetaData> thingMetas) { | private void useThingsOnResult(ArrayList<ThingMetaData> thingMetas) { | ||||
| switch(configManager.getResultConfig().action) { | switch(configManager.getResultConfig().action) { | ||||
| case REP: | case REP: | ||||
| ThingProvider.INSTANCE.replaceThingMetas(thingMetas); | |||||
| thingProvider.replaceThingMetas(thingMetas); | |||||
| break; | break; | ||||
| case ADD: | case ADD: | ||||
| ThingProvider.INSTANCE.addThingMetas(thingMetas); | |||||
| thingProvider.addThingMetas(thingMetas); | |||||
| break; | break; | ||||
| case SUB: | case SUB: | ||||
| ThingProvider.INSTANCE.subtractThingMetas(thingMetas); | |||||
| thingProvider.subtractThingMetas(thingMetas); | |||||
| break; | break; | ||||
| case AND: | case AND: | ||||
| ThingProvider.INSTANCE.intersectThingMetas(thingMetas); | |||||
| thingProvider.intersectThingMetas(thingMetas); | |||||
| break; | break; | ||||
| } | } | ||||
| eventBroker.send(EventConstants.TOPIC_RESULT_CHANGED, ""); | eventBroker.send(EventConstants.TOPIC_RESULT_CHANGED, ""); | ||||