| @@ -0,0 +1,53 @@ | |||||
| plugins { | |||||
| id 'distribution' | |||||
| id 'maven-publish' | |||||
| } | |||||
| repositories { | |||||
| mavenCentral() | |||||
| } | |||||
| configurations { | |||||
| jre | |||||
| } | |||||
| dependencies { | |||||
| jre 'net.adoptopenjdk:jre:11.0.10_9:x64@zip' | |||||
| } | |||||
| def client_exe_dir = "${buildDir}/unpacked/client" | |||||
| def versionEnding = System.getProperty("release.marker") == 'doRelease' ? '' : '-SNAPSHOT' | |||||
| version = "1.0.5"+versionEnding | |||||
| task unpackClient(type: Copy) { | |||||
| from zipTree('cnf.run/generated/distributions/executable/eclipse.jar') | |||||
| into client_exe_dir | |||||
| } | |||||
| task unpackJre(type: Copy, dependsOn: unpackClient) { | |||||
| from zipTree(configurations.jre.singleFile) | |||||
| into "${client_exe_dir}/jre" | |||||
| } | |||||
| distributions { | |||||
| main { | |||||
| baseName = 'minimal.eclipse.bnd' | |||||
| contents { from "${client_exe_dir}" } | |||||
| } | |||||
| } | |||||
| publish.dependsOn unpackJre | |||||
| publishing { | |||||
| publications { | |||||
| maven(MavenPublication) { | |||||
| artifact distZip | |||||
| groupId = 'minimal.eclipse.bnd' | |||||
| artifactId = 'minimal.eclipse.bnd.client' | |||||
| } | |||||
| } | |||||
| repositories { | |||||
| maven "${buildDir}/repo/" | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,6 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <classpath> | |||||
| <classpathentry kind="con" path="aQute.bnd.classpath.container"/> | |||||
| <classpathentry kind="src" output="bin" path="src"/> | |||||
| <classpathentry kind="output" path="bin"/> | |||||
| </classpath> | |||||
| @@ -0,0 +1,3 @@ | |||||
| /bin/ | |||||
| /generated/ | |||||
| /instance_area/ | |||||
| @@ -0,0 +1,23 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <projectDescription> | |||||
| <name>cnf.run</name> | |||||
| <comment></comment> | |||||
| <projects> | |||||
| </projects> | |||||
| <buildSpec> | |||||
| <buildCommand> | |||||
| <name>org.eclipse.jdt.core.javabuilder</name> | |||||
| <arguments> | |||||
| </arguments> | |||||
| </buildCommand> | |||||
| <buildCommand> | |||||
| <name>bndtools.core.bndbuilder</name> | |||||
| <arguments> | |||||
| </arguments> | |||||
| </buildCommand> | |||||
| </buildSpec> | |||||
| <natures> | |||||
| <nature>org.eclipse.jdt.core.javanature</nature> | |||||
| <nature>bndtools.core.bndnature</nature> | |||||
| </natures> | |||||
| </projectDescription> | |||||
| @@ -0,0 +1,5 @@ | |||||
| Bundle-SymbolicName: ${project.name};singleton:=true | |||||
| Bundle-Version: 1.0.0-SNAPSHOT | |||||
| Bundle-Name: BggToolsAnother | |||||
| Bundle-Copyright: Wiebke Tiimm | |||||
| Bundle-License: MIT | |||||
| @@ -0,0 +1,49 @@ | |||||
| -runee: JavaSE-11 | |||||
| #-resolve.effective: active;skip:="osgi.service" | |||||
| -runpath:\ | |||||
| org.gecko.bnd.eclipse.launcher.plugin;version='[1.0.6,2)',\ | |||||
| org.gecko.bnd.equinox.launcher.splashscreen;version='[1.0.1,2)' | |||||
| -runfw: org.eclipse.osgi;version='[3.17.100.v20211104-1730,3.17.100.v20211104-1730]' | |||||
| -runproperties.eclipse: \ | |||||
| eclipse.product=xyz.veroni.bgg.product | |||||
| eclipse.application=org.eclipse.e4.ui.workbench.swt.E4Application,\ | |||||
| -runproperties.common: \ | |||||
| eclipse.product=xyz.veroni.bgg.dings,\ | |||||
| osgi.console=,\ | |||||
| console=,\ | |||||
| eclipse.consoleLog=,\ | |||||
| osgi.console.enable.builtin=false,\ | |||||
| consoleLog=,\ | |||||
| osgi.instance.area=${.}/test_workspace,\ | |||||
| name=,\ | |||||
| splash.location=splash/splash.bmp | |||||
| # A couple of older bundles in the Eclipse targetplatform, expect certain packages e.g. from the javax namespace to be loaded from the System ClassLoader. | |||||
| # Uncomment this if you stume about ClassNotFoundExceptions for javax.* Classes or org.w3c.* etc. | |||||
| #-runproperties.compatible.bootdelegation: \ | |||||
| # osgi.compatibility.bootdelegation=true | |||||
| -includeresource: \ | |||||
| /splash/splash.bmp=${.}/splash/splash.bmp | |||||
| -runrequires: \ | |||||
| bnd.identity;id='org.eclipse.equinox.event',\ | |||||
| osgi.identity;filter:='(&(osgi.identity=jakarta.servlet-api)(version>=4.0.0))',\ | |||||
| osgi.identity;filter:='(&(osgi.identity=org.apache.felix.gogo.runtime)(version>=1.1.4))',\ | |||||
| osgi.identity;filter:='(&(osgi.identity=osgi.cmpn)(version>=7.0.0))',\ | |||||
| osgi.identity;filter:='(&(osgi.identity=osgi.cmpn)(version>=6.0.0))' | |||||
| -runbundles: \ | |||||
| org.apache.felix.scr;version='[2.1.14,2.1.15)',\ | |||||
| org.eclipse.equinox.event;version='[1.6.100,1.6.101)',\ | |||||
| org.eclipse.osgi.services;version='[3.10.200,3.10.201)',\ | |||||
| org.osgi.util.function;version='[1.1.0,1.1.1)',\ | |||||
| org.osgi.util.promise;version='[1.1.1,1.1.2)' | |||||
| -runblacklist: \ | |||||
| bnd.identity;id='org.apache.felix.eventadmin' | |||||
| @@ -0,0 +1,18 @@ | |||||
| -include: launch_base.bndrun | |||||
| -runsystemcapabilities: ${native_capability;osname=Linux;osversion=3.14;processor=x86_64} | |||||
| -runprovidedcapabilities: ${native_capability;osname=Linux;osversion=3.14;processor=x86_64} | |||||
| -runrequires.win32: \ | |||||
| bnd.identity;id='org.eclipse.swt.gtk.linux.x86_64',\ | |||||
| bnd.identity;id='org.eclipse.core.filesystem.linux.x86_64',\ | |||||
| bnd.identity;id='org.eclipse.core.net.linux.x86_64',\ | |||||
| bnd.identity;id='org.eclipse.equinox.security.linux.x86_64' | |||||
| -runbundles.win32: \ | |||||
| org.eclipse.core.filesystem.linux.x86_64;version='[1.4.200,1.4.201)',\ | |||||
| org.eclipse.core.net.linux.x86_64;version='[1.1.400,1.1.401)',\ | |||||
| org.eclipse.equinox.security.linux.x86_64;version='[1.1.200,1.1.201)',\ | |||||
| org.eclipse.swt.gtk.linux.x86_64;version='[3.112.0,3.112.1)' | |||||
| @@ -0,0 +1,33 @@ | |||||
| -include: launch_base.bndrun | |||||
| -runrequires.macos: \ | |||||
| bnd.identity;id='org.eclipse.core.filesystem.macosx',\ | |||||
| bnd.identity;id='org.eclipse.e4.ui.workbench.renderers.swt.cocoa',\ | |||||
| bnd.identity;id='org.eclipse.equinox.security.macosx',\ | |||||
| bnd.identity;id='org.eclipse.jdt.launching.macosx',\ | |||||
| bnd.identity;id='org.eclipse.jdt.launching.ui.macosx',\ | |||||
| bnd.identity;id='org.eclipse.swt.cocoa.macosx.x86_64',\ | |||||
| bnd.identity;id='org.eclipse.ui.cocoa' | |||||
| -runvm.macos: \ | |||||
| -XstartOnFirstThread, \ | |||||
| -Djava.awt.headless=true, \ | |||||
| -Dorg.eclipse.swt.internal.carbon.smallFonts | |||||
| -runsystemcapabilities.macos: \ | |||||
| osgi.native;osgi.native.osname:List<String>="macosx";osgi.native.processor:List<String>="x86-64" | |||||
| -runproperties.macos: \ | |||||
| osgi.ws=cocoa,\ | |||||
| osgi.arch=x86_64,\ | |||||
| osgi.os=macosx | |||||
| -runblacklist.macos: \ | |||||
| osgi.identity;filter:='(osgi.identity=*linux*)',\ | |||||
| osgi.identity;filter:='(osgi.identity=*win32*)',\ | |||||
| -runbundles.macos: \ | |||||
| org.eclipse.core.filesystem.macosx;version='[1.3,1.4)',\ | |||||
| org.eclipse.equinox.security.macosx;version='[1.101,1.102)',\ | |||||
| org.eclipse.swt.cocoa.macosx.x86_64;version='[3.118,3.119)',\ | |||||
| @@ -0,0 +1,19 @@ | |||||
| -include: launch_base.bndrun | |||||
| -runsystemcapabilities: ${native_capability;osname=Windows;osversion=10;processor=x86_64} | |||||
| -runprovidedcapabilities: ${native_capability;osname=Windows;osversion=10;processor=x86_64} | |||||
| -runrequires.win32: \ | |||||
| bnd.identity;id='org.eclipse.swt.win32.win32.x86_64',\ | |||||
| bnd.identity;id='org.eclipse.core.filesystem.win32.x86_64',\ | |||||
| bnd.identity;id='org.eclipse.core.net.win32.x86_64',\ | |||||
| bnd.identity;id='org.eclipse.equinox.security.win32.x86_64' | |||||
| -runbundles.win32: \ | |||||
| org.eclipse.core.filesystem.win32.x86_64;version='[1.4.200,1.4.201)',\ | |||||
| org.eclipse.core.net.win32.x86_64;version='[1.1.400,1.1.401)',\ | |||||
| org.eclipse.equinox.security.win32.x86_64;version='[1.1.200,1.1.201)',\ | |||||
| org.eclipse.swt.win32.win32.x86_64;version='[3.112.0,3.112.1)' | |||||
| -runtrace: true | |||||
| @@ -0,0 +1,2 @@ | |||||
| /cache/ | |||||
| local_maven_repo.mvn | |||||
| @@ -1,11 +1,11 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <projectDescription> | |||||
| <name>xyz.veronie.bgg.product</name> | |||||
| <comment></comment> | |||||
| <projects> | |||||
| </projects> | |||||
| <buildSpec> | |||||
| </buildSpec> | |||||
| <natures> | |||||
| </natures> | |||||
| </projectDescription> | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <projectDescription> | |||||
| <name>cnf</name> | |||||
| <comment></comment> | |||||
| <projects> | |||||
| </projects> | |||||
| <buildSpec> | |||||
| </buildSpec> | |||||
| <natures> | |||||
| </natures> | |||||
| </projectDescription> | |||||
| @@ -0,0 +1,41 @@ | |||||
| Automatic-Module-Name: ${def;bsn} | |||||
| -sources: true | |||||
| # Always use contracts | |||||
| -contract: * | |||||
| junit: org.apache.servicemix.bundles.junit;version="[4.13,5)" | |||||
| -testpath.junit: ${junit} | |||||
| javac.source: 1.11 | |||||
| javac.target: 1.11 | |||||
| # fixup for bundles with improper manifest, e.g. 'No metadata for revision *' | |||||
| -fixupmessages: \ | |||||
| "No metadata for revision"; \ | |||||
| restrict:=error;\ | |||||
| is:=warning | |||||
| eclipse.version = 4.22 | |||||
| eclipse.platform.version = R-4.22-202111241800 | |||||
| #The original Eclipse p2 repository, cached by our artifactory for faster access: | |||||
| -plugin.1.eclipse.platform: \ | |||||
| aQute.bnd.repository.p2.provider.P2Repository; \ | |||||
| name = "Eclipse Platform ${eclipse.version}"; \ | |||||
| url = "http://download.eclipse.org/eclipse/updates/${eclipse.version}/${eclipse.platform.version}"; \ | |||||
| cache = "${build}/cnf/cache" | |||||
| #The Nexus from Data In Motion, containing bundles to correctly start and export RCP applications | |||||
| -plugin.2.geckorcp:\ | |||||
| aQute.bnd.repository.maven.pom.provider.BndPomRepository;\ | |||||
| name="Gecko Equinox RCP BOM";\ | |||||
| releaseUrls="https://repo.maven.apache.org/maven2/";\ | |||||
| revision="org.geckoprojects.equinox:org.gecko.bnd.eclipse.bom:1.1.0" | |||||
| -plugin.3.central = \ | |||||
| aQute.bnd.repository.maven.provider.MavenBndRepository; \ | |||||
| releaseUrl=https://repo.maven.apache.org/maven2/; \ | |||||
| index=${.}/central.maven; \ | |||||
| name="Central" | |||||
| @@ -0,0 +1,5 @@ | |||||
| org.apache.servicemix.bundles:org.apache.servicemix.bundles.junit:4.13.2_1 | |||||
| org.slf4j:log4j-over-slf4j:1.7.36 | |||||
| ch.qos.logback:logback-classic:1.2.11 | |||||
| ch.qos.logback:logback-core:1.2.11 | |||||
| io.github.willena:sqlite-jdbc:3.37.2 | |||||
| @@ -0,0 +1,13 @@ | |||||
| Bundle-ActivationPolicy: lazy | |||||
| -includeresource.fragment: \ | |||||
| -Application.e4xmi,\ | |||||
| -fragment.e4xmi,\ | |||||
| -fragment_always.e4xmi,\ | |||||
| -plugin_customization.ini,\ | |||||
| -plugin.xml,\ | |||||
| OSGI-INF/=-OSGI-INF,\ | |||||
| icons/=-icons,\ | |||||
| css/=-css,\ | |||||
| schema/=-schema | |||||
| @@ -0,0 +1,2 @@ | |||||
| bnd_version=5.3.0 | |||||
| bnd_snapshots=https://bndtools.jfrog.io/bndtools/libs-snapshot-local | |||||
| @@ -0,0 +1,13 @@ | |||||
| pluginManagement { | |||||
| plugins { | |||||
| id 'biz.aQute.bnd.workspace' version bnd_version | |||||
| } | |||||
| repositories { | |||||
| maven { url bnd_snapshots } | |||||
| gradlePluginPortal() | |||||
| } | |||||
| } | |||||
| plugins { | |||||
| id 'biz.aQute.bnd.workspace' | |||||
| } | |||||
| @@ -1,17 +0,0 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <projectDescription> | |||||
| <name>xyz.veronie.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> | |||||
| @@ -1 +0,0 @@ | |||||
| bin.includes = feature.xml | |||||
| @@ -1,27 +0,0 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <feature | |||||
| id="xyz.veronie.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="xyz.veronie.bgg.ui" | |||||
| download-size="0" | |||||
| install-size="0" | |||||
| version="0.0.0" | |||||
| unpack="false"/> | |||||
| </feature> | |||||
| @@ -1,52 +0,0 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <?pde version="3.5"?> | |||||
| <product name="BggToolAnother" uid="bggtoolanother" id="xyz.veronie.bgg.ui.bggtoolanother" 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="xyz.veronie.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> | |||||
| @@ -1,18 +1,15 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <classpath> | |||||
| <classpathentry exported="true" kind="lib" path="lib/"/> | |||||
| <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="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | |||||
| <attributes> | |||||
| <attribute name="maven.pomderived" value="true"/> | |||||
| </attributes> | |||||
| </classpathentry> | |||||
| <classpathentry kind="lib" path="swing2swt.jar"/> | |||||
| <classpathentry kind="output" path="target/classes"/> | |||||
| </classpath> | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <classpath> | |||||
| <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"> | |||||
| <attributes> | |||||
| <attribute name="module" value="true"/> | |||||
| </attributes> | |||||
| </classpathentry> | |||||
| <classpathentry kind="con" path="aQute.bnd.classpath.container"> | |||||
| <attributes> | |||||
| <attribute name="module" value="true"/> | |||||
| </attributes> | |||||
| </classpathentry> | |||||
| <classpathentry kind="src" output="bin" path="src"/> | |||||
| <classpathentry kind="output" path="bin"/> | |||||
| </classpath> | |||||
| @@ -1,28 +1,23 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <projectDescription> | |||||
| <name>xyz.veronie.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> | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <projectDescription> | |||||
| <name>experiment</name> | |||||
| <comment></comment> | |||||
| <projects> | |||||
| </projects> | |||||
| <buildSpec> | |||||
| <buildCommand> | |||||
| <name>org.eclipse.jdt.core.javabuilder</name> | |||||
| <arguments> | |||||
| </arguments> | |||||
| </buildCommand> | |||||
| <buildCommand> | |||||
| <name>bndtools.core.bndbuilder</name> | |||||
| <arguments> | |||||
| </arguments> | |||||
| </buildCommand> | |||||
| </buildSpec> | |||||
| <natures> | |||||
| <nature>org.eclipse.jdt.core.javanature</nature> | |||||
| <nature>bndtools.core.bndnature</nature> | |||||
| </natures> | |||||
| </projectDescription> | |||||
| @@ -1,27 +0,0 @@ | |||||
| Manifest-Version: 1.0 | |||||
| Bundle-ManifestVersion: 2 | |||||
| Bundle-Name: Secondtry | |||||
| Bundle-SymbolicName: xyz.veronie.bgg.ui;singleton:=true | |||||
| Bundle-Version: 1.0.0.qualifier | |||||
| Bundle-ClassPath: lib/sqlite-jdbc-3.34.0.jar, | |||||
| swing2swt.jar | |||||
| Require-Bundle: org.eclipse.core.runtime, | |||||
| org.eclipse.swt, | |||||
| org.eclipse.e4.core.di, | |||||
| org.eclipse.e4.ui.workbench, | |||||
| org.eclipse.e4.ui.di, | |||||
| org.eclipse.e4.core.di.extensions, | |||||
| javax.annotation, | |||||
| org.eclipse.jface, | |||||
| org.eclipse.e4.core.services, | |||||
| org.eclipse.osgi.services, | |||||
| javax.inject, | |||||
| org.eclipse.e4.ui.model.workbench | |||||
| Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | |||||
| Import-Package: javax.annotation;version="1.0.0";resolution:=optional, | |||||
| javax.inject;version="1.0.0", | |||||
| org.eclipse.e4.core.commands, | |||||
| org.eclipse.e4.core.contexts;version="1.7.0", | |||||
| org.eclipse.e4.ui.model.application.descriptor.basic, | |||||
| org.eclipse.e4.ui.model.application.ui.basic | |||||
| Automatic-Module-Name: de.wt.secondtry | |||||
| @@ -0,0 +1,42 @@ | |||||
| Bundle-SymbolicName: ${project.name};singleton:=true | |||||
| Bundle-Version: 1.0.0.SNAPSHOT | |||||
| -includeresource: \ | |||||
| Application.e4xmi,\ | |||||
| plugin.xml | |||||
| -buildpath: \ | |||||
| org.eclipse.swt.cocoa.macosx.x86_64,\ | |||||
| org.eclipse.e4.ui.swt.win32,\ | |||||
| org.eclipse.jface,\ | |||||
| org.eclipse.equinox.preferences,\ | |||||
| org.eclipse.osgi,\ | |||||
| org.eclipse.e4.core.di.annotations,\ | |||||
| javax.inject,\ | |||||
| org.eclipse.e4.core.contexts,\ | |||||
| org.eclipse.e4.ui.model.workbench,\ | |||||
| org.eclipse.e4.ui.workbench,\ | |||||
| org.eclipse.e4.core.services,\ | |||||
| javax.annotation,\ | |||||
| org.eclipse.e4.core.di,\ | |||||
| org.eclipse.e4.core.commands,\ | |||||
| org.eclipse.core.commands,\ | |||||
| org.eclipse.e4.ui.di,\ | |||||
| org.eclipse.core.jobs,\ | |||||
| org.eclipse.equinox.common,\ | |||||
| org.eclipse.tips.ui | |||||
| -privatepackage: \ | |||||
| xyz.veronie.bgg.localdb,\ | |||||
| xyz.veronie.bgg.result,\ | |||||
| xyz.veronie.bgg.result.internal,\ | |||||
| xyz.veronie.bgg.types,\ | |||||
| xyz.veronie.bgg.ui.dialogs,\ | |||||
| xyz.veronie.bgg.ui.filters,\ | |||||
| xyz.veronie.bgg.ui.filters.composites,\ | |||||
| xyz.veronie.bgg.ui.handlers,\ | |||||
| xyz.veronie.bgg.ui.helpers,\ | |||||
| xyz.veronie.bgg.ui.parts,\ | |||||
| xyz.veronie.bgg.ui.parts.internal,\ | |||||
| xyz.veronie.bgg.ui.result | |||||
| @@ -1,8 +0,0 @@ | |||||
| output.. = bin/ | |||||
| bin.includes = META-INF/,\ | |||||
| plugin.xml,\ | |||||
| Application.e4xmi,\ | |||||
| lib/,\ | |||||
| ./,\ | |||||
| lib/sqlite-jdbc-3.34.0.jar | |||||
| source.lib/sqlite-jdbc-3.34.0.jar = src/ | |||||
| @@ -1,438 +0,0 @@ | |||||
| /******************************************************************************* | |||||
| * Copyright (c) 2011 Google, Inc. and others | |||||
| * All rights reserved. This program and the accompanying materials | |||||
| * are made available under the terms of the Eclipse Public License v1.0 | |||||
| * which accompanies this distribution, and is available at | |||||
| * http://www.eclipse.org/legal/epl-v10.html | |||||
| * | |||||
| * Contributors: | |||||
| * Google, Inc. - initial API and implementation | |||||
| * Wim Jongman - 1.8 and higher compliance | |||||
| *******************************************************************************/ | |||||
| package org.eclipse.wb.swt; | |||||
| import java.io.File; | |||||
| import java.io.InputStream; | |||||
| import java.lang.reflect.Constructor; | |||||
| import java.lang.reflect.Method; | |||||
| import java.net.MalformedURLException; | |||||
| import java.net.URL; | |||||
| import java.util.HashMap; | |||||
| import java.util.Iterator; | |||||
| import java.util.Map; | |||||
| import org.eclipse.core.runtime.Platform; | |||||
| import org.eclipse.jface.resource.CompositeImageDescriptor; | |||||
| import org.eclipse.jface.resource.ImageDescriptor; | |||||
| import org.eclipse.swt.graphics.Image; | |||||
| import org.eclipse.swt.graphics.ImageData; | |||||
| import org.eclipse.swt.graphics.ImageDataProvider; | |||||
| import org.eclipse.swt.graphics.Point; | |||||
| import org.eclipse.swt.graphics.Rectangle; | |||||
| import org.osgi.framework.Bundle; | |||||
| /** | |||||
| * Utility class for managing OS resources associated with SWT/JFace controls | |||||
| * such as colors, fonts, images, etc. | |||||
| * | |||||
| * This class is created automatically when you fiddle around with images and | |||||
| * colors in WB. You might want to prevent your application from using this | |||||
| * class and provide your own more effective means of resource caching. | |||||
| * | |||||
| * Even though this class can be used to manage these resources, if they are | |||||
| * here for the duration of the application and not used then you still have an | |||||
| * effective resource leak. | |||||
| * | |||||
| * Application code must explicitly invoke the <code>dispose()</code> method to | |||||
| * release the operating system resources managed by cached objects when those | |||||
| * objects and OS resources are no longer needed. | |||||
| * | |||||
| * This class may be freely distributed as part of any application or plugin. | |||||
| * <p> | |||||
| * | |||||
| * @author scheglov_ke | |||||
| * @author Dan Rubel | |||||
| * @author Wim Jongman | |||||
| */ | |||||
| public class ResourceManager extends SWTResourceManager { | |||||
| /** | |||||
| * The map where we store our images. | |||||
| */ | |||||
| private static Map<ImageDescriptor, Image> m_descriptorImageMap = new HashMap<ImageDescriptor, Image>(); | |||||
| /** | |||||
| * Returns an {@link ImageDescriptor} stored in the file at the specified path | |||||
| * relative to the specified class. | |||||
| * | |||||
| * @param clazz the {@link Class} relative to which to find the image | |||||
| * descriptor. | |||||
| * @param path the path to the image file. | |||||
| * @return the {@link ImageDescriptor} stored in the file at the specified path. | |||||
| */ | |||||
| public static ImageDescriptor getImageDescriptor(Class<?> clazz, String path) { | |||||
| return ImageDescriptor.createFromFile(clazz, path); | |||||
| } | |||||
| /** | |||||
| * Returns an {@link ImageDescriptor} stored in the file at the specified path. | |||||
| * | |||||
| * @param path the path to the image file. | |||||
| * @return the {@link ImageDescriptor} stored in the file at the specified path. | |||||
| */ | |||||
| public static ImageDescriptor getImageDescriptor(String path) { | |||||
| try { | |||||
| return ImageDescriptor.createFromURL(new File(path).toURI().toURL()); | |||||
| } catch (MalformedURLException e) { | |||||
| return null; | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Returns an {@link Image} based on the specified {@link ImageDescriptor}. | |||||
| * | |||||
| * @param descriptor the {@link ImageDescriptor} for the {@link Image}. | |||||
| * @return the {@link Image} based on the specified {@link ImageDescriptor}. | |||||
| */ | |||||
| public static Image getImage(ImageDescriptor descriptor) { | |||||
| if (descriptor == null) { | |||||
| return null; | |||||
| } | |||||
| Image image = m_descriptorImageMap.get(descriptor); | |||||
| if (image == null) { | |||||
| image = descriptor.createImage(); | |||||
| m_descriptorImageMap.put(descriptor, image); | |||||
| } | |||||
| return image; | |||||
| } | |||||
| /** | |||||
| * Maps images to decorated images. | |||||
| */ | |||||
| @SuppressWarnings("unchecked") | |||||
| private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY]; | |||||
| /** | |||||
| * Returns an {@link Image} composed of a base image decorated by another image. | |||||
| * | |||||
| * @param baseImage the base {@link Image} that should be decorated. | |||||
| * @param decorator the {@link Image} to decorate the base image. | |||||
| * @return {@link Image} The resulting decorated image. | |||||
| */ | |||||
| public static Image decorateImage(Image baseImage, Image decorator) { | |||||
| return decorateImage(baseImage, decorator, BOTTOM_RIGHT); | |||||
| } | |||||
| /** | |||||
| * Returns an {@link Image} composed of a base image decorated by another image. | |||||
| * | |||||
| * @param baseImage | |||||
| * the base {@link Image} that should be decorated. | |||||
| * @param decorator | |||||
| * the {@link Image} to decorate the base image. | |||||
| * @param corner | |||||
| * the corner to place decorator image. | |||||
| * @return the resulting decorated {@link Image}. | |||||
| */ | |||||
| public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) { | |||||
| if (corner <= 0 || corner >= LAST_CORNER_KEY) { | |||||
| throw new IllegalArgumentException("Wrong decorate corner"); | |||||
| } | |||||
| Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner]; | |||||
| if (cornerDecoratedImageMap == null) { | |||||
| cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>(); | |||||
| m_decoratedImageMap[corner] = cornerDecoratedImageMap; | |||||
| } | |||||
| Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage); | |||||
| if (decoratedMap == null) { | |||||
| decoratedMap = new HashMap<Image, Image>(); | |||||
| cornerDecoratedImageMap.put(baseImage, decoratedMap); | |||||
| } | |||||
| // | |||||
| Image result = decoratedMap.get(decorator); | |||||
| if (result == null) { | |||||
| final Rectangle bib = baseImage.getBounds(); | |||||
| final Rectangle dib = decorator.getBounds(); | |||||
| final Point baseImageSize = new Point(bib.width, bib.height); | |||||
| CompositeImageDescriptor compositImageDesc = new CompositeImageDescriptor() { | |||||
| @Override | |||||
| protected void drawCompositeImage(int width, int height) { | |||||
| drawImage(createCachedImageDataProvider(baseImage), 0, 0); | |||||
| if (corner == TOP_LEFT) { | |||||
| drawImage(getUnzoomedImageDataProvider(decorator.getImageData()) , 0, 0); | |||||
| } else if (corner == TOP_RIGHT) { | |||||
| drawImage(getUnzoomedImageDataProvider(decorator.getImageData()), bib.width - dib.width, 0); | |||||
| } else if (corner == BOTTOM_LEFT) { | |||||
| drawImage(getUnzoomedImageDataProvider(decorator.getImageData()), 0, bib.height - dib.height); | |||||
| } else if (corner == BOTTOM_RIGHT) { | |||||
| drawImage(getUnzoomedImageDataProvider(decorator.getImageData()), bib.width - dib.width, bib.height - dib.height); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| protected Point getSize() { | |||||
| return baseImageSize; | |||||
| } | |||||
| }; | |||||
| // | |||||
| result = compositImageDesc.createImage(); | |||||
| decoratedMap.put(decorator, result); | |||||
| } | |||||
| return result; | |||||
| } | |||||
| private static ImageDataProvider getUnzoomedImageDataProvider(ImageData imageData) { | |||||
| return zoom -> zoom == 100 ? imageData : null; | |||||
| } | |||||
| /** | |||||
| * Dispose all of the cached images. | |||||
| */ | |||||
| public static void disposeImages() { | |||||
| SWTResourceManager.disposeImages(); | |||||
| // dispose ImageDescriptor images | |||||
| { | |||||
| for (Iterator<Image> I = m_descriptorImageMap.values().iterator(); I.hasNext();) { | |||||
| I.next().dispose(); | |||||
| } | |||||
| m_descriptorImageMap.clear(); | |||||
| } | |||||
| // dispose decorated images | |||||
| for (int i = 0; i < m_decoratedImageMap.length; i++) { | |||||
| Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i]; | |||||
| if (cornerDecoratedImageMap != null) { | |||||
| for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) { | |||||
| for (Image image : decoratedMap.values()) { | |||||
| image.dispose(); | |||||
| } | |||||
| decoratedMap.clear(); | |||||
| } | |||||
| cornerDecoratedImageMap.clear(); | |||||
| } | |||||
| } | |||||
| // dispose plugin images | |||||
| { | |||||
| for (Iterator<Image> I = m_URLImageMap.values().iterator(); I.hasNext();) { | |||||
| I.next().dispose(); | |||||
| } | |||||
| m_URLImageMap.clear(); | |||||
| } | |||||
| } | |||||
| //////////////////////////////////////////////////////////////////////////// | |||||
| // | |||||
| // Plugin images support | |||||
| // | |||||
| //////////////////////////////////////////////////////////////////////////// | |||||
| /** | |||||
| * Maps URL to images. | |||||
| */ | |||||
| private static Map<String, Image> m_URLImageMap = new HashMap<String, Image>(); | |||||
| /** | |||||
| * Provider for plugin resources, used by WindowBuilder at design time. | |||||
| */ | |||||
| public interface PluginResourceProvider { | |||||
| URL getEntry(String symbolicName, String path); | |||||
| } | |||||
| /** | |||||
| * Instance of {@link PluginResourceProvider}, used by WindowBuilder at design | |||||
| * time. | |||||
| */ | |||||
| private static PluginResourceProvider m_designTimePluginResourceProvider = null; | |||||
| /** | |||||
| * Returns an {@link Image} based on a plugin and file path. | |||||
| * | |||||
| * @param plugin the plugin {@link Object} containing the image | |||||
| * @param name the path to the image within the plugin | |||||
| * @return the {@link Image} stored in the file at the specified path | |||||
| * | |||||
| * @deprecated Use {@link #getPluginImage(String, String)} instead. | |||||
| */ | |||||
| @Deprecated | |||||
| public static Image getPluginImage(Object plugin, String name) { | |||||
| try { | |||||
| URL url = getPluginImageURL(plugin, name); | |||||
| if (url != null) { | |||||
| return getPluginImageFromUrl(url); | |||||
| } | |||||
| } catch (Throwable e) { | |||||
| // Ignore any exceptions | |||||
| } | |||||
| return null; | |||||
| } | |||||
| /** | |||||
| * Returns an {@link Image} based on a {@link Bundle} and resource entry path. | |||||
| * | |||||
| * @param symbolicName the symbolic name of the {@link Bundle}. | |||||
| * @param path the path of the resource entry. | |||||
| * @return the {@link Image} stored in the file at the specified path. | |||||
| */ | |||||
| public static Image getPluginImage(String symbolicName, String path) { | |||||
| try { | |||||
| URL url = getPluginImageURL(symbolicName, path); | |||||
| if (url != null) { | |||||
| return getPluginImageFromUrl(url); | |||||
| } | |||||
| } catch (Throwable e) { | |||||
| // Ignore any exceptions | |||||
| } | |||||
| return null; | |||||
| } | |||||
| /** | |||||
| * Returns an {@link Image} based on given {@link URL}. | |||||
| */ | |||||
| private static Image getPluginImageFromUrl(URL url) { | |||||
| try { | |||||
| try { | |||||
| String key = url.toExternalForm(); | |||||
| Image image = m_URLImageMap.get(key); | |||||
| if (image == null) { | |||||
| InputStream stream = url.openStream(); | |||||
| try { | |||||
| image = getImage(stream); | |||||
| m_URLImageMap.put(key, image); | |||||
| } finally { | |||||
| stream.close(); | |||||
| } | |||||
| } | |||||
| return image; | |||||
| } catch (Throwable e) { | |||||
| // Ignore any exceptions | |||||
| } | |||||
| } catch (Throwable e) { | |||||
| // Ignore any exceptions | |||||
| } | |||||
| return null; | |||||
| } | |||||
| /** | |||||
| * Returns an {@link ImageDescriptor} based on a plugin and file path. | |||||
| * | |||||
| * @param plugin the plugin {@link Object} containing the image. | |||||
| * @param name the path to th eimage within the plugin. | |||||
| * @return the {@link ImageDescriptor} stored in the file at the specified path. | |||||
| * | |||||
| * @deprecated Use {@link #getPluginImageDescriptor(String, String)} instead. | |||||
| */ | |||||
| @Deprecated | |||||
| public static ImageDescriptor getPluginImageDescriptor(Object plugin, String name) { | |||||
| try { | |||||
| try { | |||||
| URL url = getPluginImageURL(plugin, name); | |||||
| return ImageDescriptor.createFromURL(url); | |||||
| } catch (Throwable e) { | |||||
| // Ignore any exceptions | |||||
| } | |||||
| } catch (Throwable e) { | |||||
| // Ignore any exceptions | |||||
| } | |||||
| return null; | |||||
| } | |||||
| /** | |||||
| * Returns an {@link ImageDescriptor} based on a {@link Bundle} and resource | |||||
| * entry path. | |||||
| * | |||||
| * @param symbolicName the symbolic name of the {@link Bundle}. | |||||
| * @param path the path of the resource entry. | |||||
| * @return the {@link ImageDescriptor} based on a {@link Bundle} and resource | |||||
| * entry path. | |||||
| */ | |||||
| public static ImageDescriptor getPluginImageDescriptor(String symbolicName, String path) { | |||||
| try { | |||||
| URL url = getPluginImageURL(symbolicName, path); | |||||
| if (url != null) { | |||||
| return ImageDescriptor.createFromURL(url); | |||||
| } | |||||
| } catch (Throwable e) { | |||||
| // Ignore any exceptions | |||||
| } | |||||
| return null; | |||||
| } | |||||
| /** | |||||
| * Returns an {@link URL} based on a {@link Bundle} and resource entry path. | |||||
| */ | |||||
| private static URL getPluginImageURL(String symbolicName, String path) { | |||||
| // try runtime plugins | |||||
| { | |||||
| Bundle bundle = Platform.getBundle(symbolicName); | |||||
| if (bundle != null) { | |||||
| return bundle.getEntry(path); | |||||
| } | |||||
| } | |||||
| // try design time provider | |||||
| if (m_designTimePluginResourceProvider != null) { | |||||
| return m_designTimePluginResourceProvider.getEntry(symbolicName, path); | |||||
| } | |||||
| // no such resource | |||||
| return null; | |||||
| } | |||||
| /** | |||||
| * Returns an {@link URL} based on a plugin and file path. | |||||
| * | |||||
| * @param plugin the plugin {@link Object} containing the file path. | |||||
| * @param name the file path. | |||||
| * @return the {@link URL} representing the file at the specified path. | |||||
| * @throws Exception | |||||
| */ | |||||
| private static URL getPluginImageURL(Object plugin, String name) throws Exception { | |||||
| // try to work with 'plugin' as with OSGI BundleContext | |||||
| try { | |||||
| Class<?> BundleClass = Class.forName("org.osgi.framework.Bundle"); //$NON-NLS-1$ | |||||
| Class<?> BundleContextClass = Class.forName("org.osgi.framework.BundleContext"); //$NON-NLS-1$ | |||||
| if (BundleContextClass.isAssignableFrom(plugin.getClass())) { | |||||
| Method getBundleMethod = BundleContextClass.getMethod("getBundle", new Class[0]); //$NON-NLS-1$ | |||||
| Object bundle = getBundleMethod.invoke(plugin, new Object[0]); | |||||
| // | |||||
| Class<?> PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$ | |||||
| Constructor<?> pathConstructor = PathClass.getConstructor(new Class[] { String.class }); | |||||
| Object path = pathConstructor.newInstance(new Object[] { name }); | |||||
| // | |||||
| Class<?> IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$ | |||||
| Class<?> PlatformClass = Class.forName("org.eclipse.core.runtime.Platform"); //$NON-NLS-1$ | |||||
| Method findMethod = PlatformClass.getMethod("find", new Class[] { BundleClass, IPathClass }); //$NON-NLS-1$ | |||||
| return (URL) findMethod.invoke(null, new Object[] { bundle, path }); | |||||
| } | |||||
| } catch (Throwable e) { | |||||
| // Ignore any exceptions | |||||
| } | |||||
| // else work with 'plugin' as with usual Eclipse plugin | |||||
| { | |||||
| Class<?> PluginClass = Class.forName("org.eclipse.core.runtime.Plugin"); //$NON-NLS-1$ | |||||
| if (PluginClass.isAssignableFrom(plugin.getClass())) { | |||||
| // | |||||
| Class<?> PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$ | |||||
| Constructor<?> pathConstructor = PathClass.getConstructor(new Class[] { String.class }); | |||||
| Object path = pathConstructor.newInstance(new Object[] { name }); | |||||
| // | |||||
| Class<?> IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$ | |||||
| Method findMethod = PluginClass.getMethod("find", new Class[] { IPathClass }); //$NON-NLS-1$ | |||||
| return (URL) findMethod.invoke(plugin, new Object[] { path }); | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| //////////////////////////////////////////////////////////////////////////// | |||||
| // | |||||
| // General | |||||
| // | |||||
| //////////////////////////////////////////////////////////////////////////// | |||||
| /** | |||||
| * Dispose of cached objects and their underlying OS resources. This should only | |||||
| * be called when the cached objects are no longer needed (e.g. on application | |||||
| * shutdown). | |||||
| */ | |||||
| public static void dispose() { | |||||
| disposeColors(); | |||||
| disposeFonts(); | |||||
| disposeImages(); | |||||
| } | |||||
| } | |||||
| @@ -1,447 +0,0 @@ | |||||
| /******************************************************************************* | |||||
| * Copyright (c) 2011 Google, Inc. | |||||
| * All rights reserved. This program and the accompanying materials | |||||
| * are made available under the terms of the Eclipse Public License v1.0 | |||||
| * which accompanies this distribution, and is available at | |||||
| * http://www.eclipse.org/legal/epl-v10.html | |||||
| * | |||||
| * Contributors: | |||||
| * Google, Inc. - initial API and implementation | |||||
| *******************************************************************************/ | |||||
| package org.eclipse.wb.swt; | |||||
| import java.io.FileInputStream; | |||||
| import java.io.IOException; | |||||
| import java.io.InputStream; | |||||
| import java.util.HashMap; | |||||
| import java.util.Map; | |||||
| import org.eclipse.swt.SWT; | |||||
| import org.eclipse.swt.graphics.Color; | |||||
| import org.eclipse.swt.graphics.Cursor; | |||||
| import org.eclipse.swt.graphics.Font; | |||||
| import org.eclipse.swt.graphics.FontData; | |||||
| import org.eclipse.swt.graphics.GC; | |||||
| import org.eclipse.swt.graphics.Image; | |||||
| import org.eclipse.swt.graphics.ImageData; | |||||
| import org.eclipse.swt.graphics.RGB; | |||||
| import org.eclipse.swt.graphics.Rectangle; | |||||
| import org.eclipse.swt.widgets.Display; | |||||
| /** | |||||
| * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc. | |||||
| * <p> | |||||
| * !!! IMPORTANT !!! Application code must explicitly invoke the <code>dispose()</code> method to release the | |||||
| * operating system resources managed by cached objects when those objects and OS resources are no longer | |||||
| * needed (e.g. on application shutdown) | |||||
| * <p> | |||||
| * This class may be freely distributed as part of any application or plugin. | |||||
| * <p> | |||||
| * @author scheglov_ke | |||||
| * @author Dan Rubel | |||||
| */ | |||||
| public class SWTResourceManager { | |||||
| //////////////////////////////////////////////////////////////////////////// | |||||
| // | |||||
| // Color | |||||
| // | |||||
| //////////////////////////////////////////////////////////////////////////// | |||||
| private static Map<RGB, Color> m_colorMap = new HashMap<RGB, Color>(); | |||||
| /** | |||||
| * Returns the system {@link Color} matching the specific ID. | |||||
| * | |||||
| * @param systemColorID | |||||
| * the ID value for the color | |||||
| * @return the system {@link Color} matching the specific ID | |||||
| */ | |||||
| public static Color getColor(int systemColorID) { | |||||
| Display display = Display.getCurrent(); | |||||
| return display.getSystemColor(systemColorID); | |||||
| } | |||||
| /** | |||||
| * Returns a {@link Color} given its red, green and blue component values. | |||||
| * | |||||
| * @param r | |||||
| * the red component of the color | |||||
| * @param g | |||||
| * the green component of the color | |||||
| * @param b | |||||
| * the blue component of the color | |||||
| * @return the {@link Color} matching the given red, green and blue component values | |||||
| */ | |||||
| public static Color getColor(int r, int g, int b) { | |||||
| return getColor(new RGB(r, g, b)); | |||||
| } | |||||
| /** | |||||
| * Returns a {@link Color} given its RGB value. | |||||
| * | |||||
| * @param rgb | |||||
| * the {@link RGB} value of the color | |||||
| * @return the {@link Color} matching the RGB value | |||||
| */ | |||||
| public static Color getColor(RGB rgb) { | |||||
| Color color = m_colorMap.get(rgb); | |||||
| if (color == null) { | |||||
| Display display = Display.getCurrent(); | |||||
| color = new Color(display, rgb); | |||||
| m_colorMap.put(rgb, color); | |||||
| } | |||||
| return color; | |||||
| } | |||||
| /** | |||||
| * Dispose of all the cached {@link Color}'s. | |||||
| */ | |||||
| public static void disposeColors() { | |||||
| for (Color color : m_colorMap.values()) { | |||||
| color.dispose(); | |||||
| } | |||||
| m_colorMap.clear(); | |||||
| } | |||||
| //////////////////////////////////////////////////////////////////////////// | |||||
| // | |||||
| // Image | |||||
| // | |||||
| //////////////////////////////////////////////////////////////////////////// | |||||
| /** | |||||
| * Maps image paths to images. | |||||
| */ | |||||
| private static Map<String, Image> m_imageMap = new HashMap<String, Image>(); | |||||
| /** | |||||
| * Returns an {@link Image} encoded by the specified {@link InputStream}. | |||||
| * | |||||
| * @param stream | |||||
| * the {@link InputStream} encoding the image data | |||||
| * @return the {@link Image} encoded by the specified input stream | |||||
| */ | |||||
| protected static Image getImage(InputStream stream) throws IOException { | |||||
| try { | |||||
| Display display = Display.getCurrent(); | |||||
| ImageData data = new ImageData(stream); | |||||
| if (data.transparentPixel > 0) { | |||||
| return new Image(display, data, data.getTransparencyMask()); | |||||
| } | |||||
| return new Image(display, data); | |||||
| } finally { | |||||
| stream.close(); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Returns an {@link Image} stored in the file at the specified path. | |||||
| * | |||||
| * @param path | |||||
| * the path to the image file | |||||
| * @return the {@link Image} stored in the file at the specified path | |||||
| */ | |||||
| public static Image getImage(String path) { | |||||
| Image image = m_imageMap.get(path); | |||||
| if (image == null) { | |||||
| try { | |||||
| image = getImage(new FileInputStream(path)); | |||||
| m_imageMap.put(path, image); | |||||
| } catch (Exception e) { | |||||
| image = getMissingImage(); | |||||
| m_imageMap.put(path, image); | |||||
| } | |||||
| } | |||||
| return image; | |||||
| } | |||||
| /** | |||||
| * Returns an {@link Image} stored in the file at the specified path relative to the specified class. | |||||
| * | |||||
| * @param clazz | |||||
| * the {@link Class} relative to which to find the image | |||||
| * @param path | |||||
| * the path to the image file, if starts with <code>'/'</code> | |||||
| * @return the {@link Image} stored in the file at the specified path | |||||
| */ | |||||
| public static Image getImage(Class<?> clazz, String path) { | |||||
| String key = clazz.getName() + '|' + path; | |||||
| Image image = m_imageMap.get(key); | |||||
| if (image == null) { | |||||
| try { | |||||
| image = getImage(clazz.getResourceAsStream(path)); | |||||
| m_imageMap.put(key, image); | |||||
| } catch (Exception e) { | |||||
| image = getMissingImage(); | |||||
| m_imageMap.put(key, image); | |||||
| } | |||||
| } | |||||
| return image; | |||||
| } | |||||
| private static final int MISSING_IMAGE_SIZE = 10; | |||||
| /** | |||||
| * @return the small {@link Image} that can be used as placeholder for missing image. | |||||
| */ | |||||
| private static Image getMissingImage() { | |||||
| Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); | |||||
| // | |||||
| GC gc = new GC(image); | |||||
| gc.setBackground(getColor(SWT.COLOR_RED)); | |||||
| gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); | |||||
| gc.dispose(); | |||||
| // | |||||
| return image; | |||||
| } | |||||
| /** | |||||
| * Style constant for placing decorator image in top left corner of base image. | |||||
| */ | |||||
| public static final int TOP_LEFT = 1; | |||||
| /** | |||||
| * Style constant for placing decorator image in top right corner of base image. | |||||
| */ | |||||
| public static final int TOP_RIGHT = 2; | |||||
| /** | |||||
| * Style constant for placing decorator image in bottom left corner of base image. | |||||
| */ | |||||
| public static final int BOTTOM_LEFT = 3; | |||||
| /** | |||||
| * Style constant for placing decorator image in bottom right corner of base image. | |||||
| */ | |||||
| public static final int BOTTOM_RIGHT = 4; | |||||
| /** | |||||
| * Internal value. | |||||
| */ | |||||
| protected static final int LAST_CORNER_KEY = 5; | |||||
| /** | |||||
| * Maps images to decorated images. | |||||
| */ | |||||
| @SuppressWarnings("unchecked") | |||||
| private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY]; | |||||
| /** | |||||
| * Returns an {@link Image} composed of a base image decorated by another image. | |||||
| * | |||||
| * @param baseImage | |||||
| * the base {@link Image} that should be decorated | |||||
| * @param decorator | |||||
| * the {@link Image} to decorate the base image | |||||
| * @return {@link Image} The resulting decorated image | |||||
| */ | |||||
| public static Image decorateImage(Image baseImage, Image decorator) { | |||||
| return decorateImage(baseImage, decorator, BOTTOM_RIGHT); | |||||
| } | |||||
| /** | |||||
| * Returns an {@link Image} composed of a base image decorated by another image. | |||||
| * | |||||
| * @param baseImage | |||||
| * the base {@link Image} that should be decorated | |||||
| * @param decorator | |||||
| * the {@link Image} to decorate the base image | |||||
| * @param corner | |||||
| * the corner to place decorator image | |||||
| * @return the resulting decorated {@link Image} | |||||
| */ | |||||
| public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) { | |||||
| if (corner <= 0 || corner >= LAST_CORNER_KEY) { | |||||
| throw new IllegalArgumentException("Wrong decorate corner"); | |||||
| } | |||||
| Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner]; | |||||
| if (cornerDecoratedImageMap == null) { | |||||
| cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>(); | |||||
| m_decoratedImageMap[corner] = cornerDecoratedImageMap; | |||||
| } | |||||
| Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage); | |||||
| if (decoratedMap == null) { | |||||
| decoratedMap = new HashMap<Image, Image>(); | |||||
| cornerDecoratedImageMap.put(baseImage, decoratedMap); | |||||
| } | |||||
| // | |||||
| Image result = decoratedMap.get(decorator); | |||||
| if (result == null) { | |||||
| Rectangle bib = baseImage.getBounds(); | |||||
| Rectangle dib = decorator.getBounds(); | |||||
| // | |||||
| result = new Image(Display.getCurrent(), bib.width, bib.height); | |||||
| // | |||||
| GC gc = new GC(result); | |||||
| gc.drawImage(baseImage, 0, 0); | |||||
| if (corner == TOP_LEFT) { | |||||
| gc.drawImage(decorator, 0, 0); | |||||
| } else if (corner == TOP_RIGHT) { | |||||
| gc.drawImage(decorator, bib.width - dib.width, 0); | |||||
| } else if (corner == BOTTOM_LEFT) { | |||||
| gc.drawImage(decorator, 0, bib.height - dib.height); | |||||
| } else if (corner == BOTTOM_RIGHT) { | |||||
| gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height); | |||||
| } | |||||
| gc.dispose(); | |||||
| // | |||||
| decoratedMap.put(decorator, result); | |||||
| } | |||||
| return result; | |||||
| } | |||||
| /** | |||||
| * Dispose all of the cached {@link Image}'s. | |||||
| */ | |||||
| public static void disposeImages() { | |||||
| // dispose loaded images | |||||
| { | |||||
| for (Image image : m_imageMap.values()) { | |||||
| image.dispose(); | |||||
| } | |||||
| m_imageMap.clear(); | |||||
| } | |||||
| // dispose decorated images | |||||
| for (int i = 0; i < m_decoratedImageMap.length; i++) { | |||||
| Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i]; | |||||
| if (cornerDecoratedImageMap != null) { | |||||
| for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) { | |||||
| for (Image image : decoratedMap.values()) { | |||||
| image.dispose(); | |||||
| } | |||||
| decoratedMap.clear(); | |||||
| } | |||||
| cornerDecoratedImageMap.clear(); | |||||
| } | |||||
| } | |||||
| } | |||||
| //////////////////////////////////////////////////////////////////////////// | |||||
| // | |||||
| // Font | |||||
| // | |||||
| //////////////////////////////////////////////////////////////////////////// | |||||
| /** | |||||
| * Maps font names to fonts. | |||||
| */ | |||||
| private static Map<String, Font> m_fontMap = new HashMap<String, Font>(); | |||||
| /** | |||||
| * Maps fonts to their bold versions. | |||||
| */ | |||||
| private static Map<Font, Font> m_fontToBoldFontMap = new HashMap<Font, Font>(); | |||||
| /** | |||||
| * Returns a {@link Font} based on its name, height and style. | |||||
| * | |||||
| * @param name | |||||
| * the name of the font | |||||
| * @param height | |||||
| * the height of the font | |||||
| * @param style | |||||
| * the style of the font | |||||
| * @return {@link Font} The font matching the name, height and style | |||||
| */ | |||||
| public static Font getFont(String name, int height, int style) { | |||||
| return getFont(name, height, style, false, false); | |||||
| } | |||||
| /** | |||||
| * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline | |||||
| * flags are also supported. | |||||
| * | |||||
| * @param name | |||||
| * the name of the font | |||||
| * @param size | |||||
| * the size of the font | |||||
| * @param style | |||||
| * the style of the font | |||||
| * @param strikeout | |||||
| * the strikeout flag (warning: Windows only) | |||||
| * @param underline | |||||
| * the underline flag (warning: Windows only) | |||||
| * @return {@link Font} The font matching the name, height, style, strikeout and underline | |||||
| */ | |||||
| public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) { | |||||
| String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline; | |||||
| Font font = m_fontMap.get(fontName); | |||||
| if (font == null) { | |||||
| FontData fontData = new FontData(name, size, style); | |||||
| if (strikeout || underline) { | |||||
| try { | |||||
| Class<?> logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$ | |||||
| Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$ | |||||
| if (logFont != null && logFontClass != null) { | |||||
| if (strikeout) { | |||||
| logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$ | |||||
| } | |||||
| if (underline) { | |||||
| logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$ | |||||
| } | |||||
| } | |||||
| } catch (Throwable e) { | |||||
| System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$ | |||||
| } | |||||
| } | |||||
| font = new Font(Display.getCurrent(), fontData); | |||||
| m_fontMap.put(fontName, font); | |||||
| } | |||||
| return font; | |||||
| } | |||||
| /** | |||||
| * Returns a bold version of the given {@link Font}. | |||||
| * | |||||
| * @param baseFont | |||||
| * the {@link Font} for which a bold version is desired | |||||
| * @return the bold version of the given {@link Font} | |||||
| */ | |||||
| public static Font getBoldFont(Font baseFont) { | |||||
| Font font = m_fontToBoldFontMap.get(baseFont); | |||||
| if (font == null) { | |||||
| FontData fontDatas[] = baseFont.getFontData(); | |||||
| FontData data = fontDatas[0]; | |||||
| font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD); | |||||
| m_fontToBoldFontMap.put(baseFont, font); | |||||
| } | |||||
| return font; | |||||
| } | |||||
| /** | |||||
| * Dispose all of the cached {@link Font}'s. | |||||
| */ | |||||
| public static void disposeFonts() { | |||||
| // clear fonts | |||||
| for (Font font : m_fontMap.values()) { | |||||
| font.dispose(); | |||||
| } | |||||
| m_fontMap.clear(); | |||||
| // clear bold fonts | |||||
| for (Font font : m_fontToBoldFontMap.values()) { | |||||
| font.dispose(); | |||||
| } | |||||
| m_fontToBoldFontMap.clear(); | |||||
| } | |||||
| //////////////////////////////////////////////////////////////////////////// | |||||
| // | |||||
| // Cursor | |||||
| // | |||||
| //////////////////////////////////////////////////////////////////////////// | |||||
| /** | |||||
| * Maps IDs to cursors. | |||||
| */ | |||||
| private static Map<Integer, Cursor> m_idToCursorMap = new HashMap<Integer, Cursor>(); | |||||
| /** | |||||
| * Returns the system cursor matching the specific ID. | |||||
| * | |||||
| * @param id | |||||
| * int The ID value for the cursor | |||||
| * @return Cursor The system cursor matching the specific ID | |||||
| */ | |||||
| public static Cursor getCursor(int id) { | |||||
| Integer key = Integer.valueOf(id); | |||||
| Cursor cursor = m_idToCursorMap.get(key); | |||||
| if (cursor == null) { | |||||
| cursor = new Cursor(Display.getDefault(), id); | |||||
| m_idToCursorMap.put(key, cursor); | |||||
| } | |||||
| return cursor; | |||||
| } | |||||
| /** | |||||
| * Dispose all of the cached cursors. | |||||
| */ | |||||
| public static void disposeCursors() { | |||||
| for (Cursor cursor : m_idToCursorMap.values()) { | |||||
| cursor.dispose(); | |||||
| } | |||||
| m_idToCursorMap.clear(); | |||||
| } | |||||
| //////////////////////////////////////////////////////////////////////////// | |||||
| // | |||||
| // General | |||||
| // | |||||
| //////////////////////////////////////////////////////////////////////////// | |||||
| /** | |||||
| * Dispose of cached objects and their underlying OS resources. This should only be called when the cached | |||||
| * objects are no longer needed (e.g. on application shutdown). | |||||
| */ | |||||
| public static void dispose() { | |||||
| disposeColors(); | |||||
| disposeImages(); | |||||
| disposeFonts(); | |||||
| disposeCursors(); | |||||
| } | |||||
| } | |||||
| @@ -23,7 +23,7 @@ import org.eclipse.swt.widgets.Label; | |||||
| import org.eclipse.swt.widgets.Shell; | import org.eclipse.swt.widgets.Shell; | ||||
| import org.eclipse.swt.widgets.Table; | import org.eclipse.swt.widgets.Table; | ||||
| import org.eclipse.swt.widgets.TableColumn; | import org.eclipse.swt.widgets.TableColumn; | ||||
| import org.eclipse.wb.swt.SWTResourceManager; | |||||
| import org.eclipse.tips.ui.internal.util.SWTResourceManager; | |||||
| import xyz.veronie.bgg.ui.helpers.BatColors; | import xyz.veronie.bgg.ui.helpers.BatColors; | ||||
| @@ -14,11 +14,13 @@ import org.eclipse.swt.widgets.Control; | |||||
| import org.eclipse.swt.widgets.Label; | import org.eclipse.swt.widgets.Label; | ||||
| import org.eclipse.swt.widgets.Shell; | import org.eclipse.swt.widgets.Shell; | ||||
| import org.eclipse.swt.widgets.Text; | import org.eclipse.swt.widgets.Text; | ||||
| import org.eclipse.wb.swt.SWTResourceManager; | |||||
| import org.eclipse.tips.ui.internal.util.SWTResourceManager; | |||||
| import xyz.veronie.bgg.ui.helpers.BatColors; | import xyz.veronie.bgg.ui.helpers.BatColors; | ||||
| public class SaveGameListDialog extends Dialog { | public class SaveGameListDialog extends Dialog { | ||||
| private static final String DIALOG_FONT = "Segoe UI"; | |||||
| private Text textField; | private Text textField; | ||||
| private String entryString; | private String entryString; | ||||
| @@ -42,7 +44,7 @@ public class SaveGameListDialog extends Dialog { | |||||
| protected Control createDialogArea(Composite parent) { | protected Control createDialogArea(Composite parent) { | ||||
| parent.setBackground(BatColors.getBackgroundColor()); | parent.setBackground(BatColors.getBackgroundColor()); | ||||
| Composite container = (Composite) super.createDialogArea(parent); | Composite container = (Composite) super.createDialogArea(parent); | ||||
| container.setFont(SWTResourceManager.getFont("Segoe UI", 11, SWT.NORMAL)); | |||||
| container.setFont(SWTResourceManager.getFont(DIALOG_FONT, 11, SWT.NORMAL)); | |||||
| container.setBackground(BatColors.getBackgroundColor()); | container.setBackground(BatColors.getBackgroundColor()); | ||||
| GridLayout gl_container = new GridLayout(1, false); | GridLayout gl_container = new GridLayout(1, false); | ||||
| gl_container.verticalSpacing = 24; | gl_container.verticalSpacing = 24; | ||||
| @@ -56,7 +58,7 @@ public class SaveGameListDialog extends Dialog { | |||||
| container.setLayout(gl_container); | container.setLayout(gl_container); | ||||
| Label lblEnterAName = new Label(container, SWT.NONE); | Label lblEnterAName = new Label(container, SWT.NONE); | ||||
| lblEnterAName.setFont(SWTResourceManager.getFont("Segoe UI", 11, SWT.NORMAL)); | |||||
| lblEnterAName.setFont(SWTResourceManager.getFont(DIALOG_FONT, 11, SWT.NORMAL)); | |||||
| lblEnterAName.setText("Enter a name for the game list:"); | lblEnterAName.setText("Enter a name for the game list:"); | ||||
| textField = new Text(container, SWT.BORDER); | textField = new Text(container, SWT.BORDER); | ||||
| @@ -68,7 +70,7 @@ public class SaveGameListDialog extends Dialog { | |||||
| btnOk.setEnabled(enableOk); | btnOk.setEnabled(enableOk); | ||||
| } | } | ||||
| }); | }); | ||||
| textField.setFont(SWTResourceManager.getFont("Segoe UI", 11, SWT.NORMAL)); | |||||
| textField.setFont(SWTResourceManager.getFont(DIALOG_FONT, 11, SWT.NORMAL)); | |||||
| textField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); | textField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); | ||||
| return container; | return container; | ||||
| @@ -10,13 +10,13 @@ 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.Button; | ||||
| import org.eclipse.swt.widgets.Composite; | import org.eclipse.swt.widgets.Composite; | ||||
| import org.eclipse.wb.swt.ResourceManager; | |||||
| import xyz.veronie.bgg.result.ResultConfigManager; | import xyz.veronie.bgg.result.ResultConfigManager; | ||||
| import xyz.veronie.bgg.types.EventConstants; | import xyz.veronie.bgg.types.EventConstants; | ||||
| import xyz.veronie.bgg.types.FilterFlagState; | import xyz.veronie.bgg.types.FilterFlagState; | ||||
| import xyz.veronie.bgg.types.UserFlag; | import xyz.veronie.bgg.types.UserFlag; | ||||
| import xyz.veronie.bgg.types.UserFlagEvent; | import xyz.veronie.bgg.types.UserFlagEvent; | ||||
| import xyz.veronie.bgg.ui.helpers.ResourceManager; | |||||
| public class FilterFlagComposite extends Composite { | public class FilterFlagComposite extends Composite { | ||||
| @@ -48,8 +48,8 @@ public class FilterFlagComposite extends Composite { | |||||
| flagSwitch = new SwitchLabel(this, SWT.NONE); | flagSwitch = new SwitchLabel(this, SWT.NONE); | ||||
| flagSwitch.setOnImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/noun_switch on_30x30.png")); | |||||
| flagSwitch.setOffImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/noun_switch off_30x30.png")); | |||||
| flagSwitch.setOnImage(ResourceManager.getPluginImageDescriptor("xyz.veronie.bgg.ui", "icons/noun_switch on_30x30.png").createImage()); | |||||
| flagSwitch.setOffImage(ResourceManager.getPluginImageDescriptor("xyz.veronie.bgg.ui", "icons/noun_switch off_30x30.png").createImage()); | |||||
| flagSwitch.setEnabled(isTurnedOn); | flagSwitch.setEnabled(isTurnedOn); | ||||
| @@ -4,14 +4,8 @@ package xyz.veronie.bgg.ui.handlers; | |||||
| import org.eclipse.e4.core.di.annotations.Execute; | import org.eclipse.e4.core.di.annotations.Execute; | ||||
| import xyz.veronie.bgg.result.BggApi; | import xyz.veronie.bgg.result.BggApi; | ||||
| import xyz.veronie.bgg.result.Thing; | |||||
| import xyz.veronie.bgg.result.ThingProvider; | import xyz.veronie.bgg.result.ThingProvider; | ||||
| import java.util.ArrayList; | |||||
| import java.util.HashSet; | |||||
| import java.util.List; | |||||
| import java.util.Set; | |||||
| import javax.inject.Inject; | import javax.inject.Inject; | ||||
| import org.eclipse.e4.core.di.annotations.CanExecute; | import org.eclipse.e4.core.di.annotations.CanExecute; | ||||
| @@ -20,7 +20,6 @@ import xyz.veronie.bgg.result.ThingProvider; | |||||
| import xyz.veronie.bgg.types.EventConstants; | import xyz.veronie.bgg.types.EventConstants; | ||||
| import xyz.veronie.bgg.ui.dialogs.LoadGameListDialog; | import xyz.veronie.bgg.ui.dialogs.LoadGameListDialog; | ||||
| @SuppressWarnings("restriction") | |||||
| public class LoadGamelistHandler { | public class LoadGamelistHandler { | ||||
| @Inject | @Inject | ||||
| @@ -1,7 +1,7 @@ | |||||
| package xyz.veronie.bgg.ui.helpers; | package xyz.veronie.bgg.ui.helpers; | ||||
| import org.eclipse.swt.graphics.Color; | import org.eclipse.swt.graphics.Color; | ||||
| import org.eclipse.wb.swt.SWTResourceManager; | |||||
| import org.eclipse.tips.ui.internal.util.SWTResourceManager; | |||||
| public class BatColors { | public class BatColors { | ||||
| @@ -0,0 +1,22 @@ | |||||
| package xyz.veronie.bgg.ui.helpers; | |||||
| import java.net.URL; | |||||
| import org.eclipse.core.runtime.FileLocator; | |||||
| import org.eclipse.core.runtime.Path; | |||||
| import org.eclipse.jface.resource.ImageDescriptor; | |||||
| import org.osgi.framework.Bundle; | |||||
| import org.osgi.framework.FrameworkUtil; | |||||
| public class ResourceManager { | |||||
| public static ImageDescriptor getPluginImageDescriptor(String plugin, String imagePath) { | |||||
| Bundle bundle = FrameworkUtil.getBundle(ResourceManager.class); | |||||
| // use the org.eclipse.core.runtime.Path as import | |||||
| URL url = FileLocator.find(bundle, | |||||
| new Path(imagePath), null); | |||||
| ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url); | |||||
| return imageDescriptor; | |||||
| } | |||||
| } | |||||
| @@ -39,16 +39,15 @@ import org.eclipse.swt.widgets.Event; | |||||
| import org.eclipse.swt.widgets.Label; | import org.eclipse.swt.widgets.Label; | ||||
| import org.eclipse.swt.widgets.Table; | import org.eclipse.swt.widgets.Table; | ||||
| import org.eclipse.swt.widgets.TableColumn; | import org.eclipse.swt.widgets.TableColumn; | ||||
| import org.eclipse.wb.swt.ResourceManager; | |||||
| import org.eclipse.wb.swt.SWTResourceManager; | |||||
| import org.eclipse.tips.ui.internal.util.SWTResourceManager; | |||||
| import xyz.veronie.bgg.result.Thing; | import xyz.veronie.bgg.result.Thing; | ||||
| import xyz.veronie.bgg.result.ThingProvider; | import xyz.veronie.bgg.result.ThingProvider; | ||||
| import xyz.veronie.bgg.types.EventConstants; | import xyz.veronie.bgg.types.EventConstants; | ||||
| import xyz.veronie.bgg.ui.helpers.BatColors; | import xyz.veronie.bgg.ui.helpers.BatColors; | ||||
| import xyz.veronie.bgg.ui.helpers.BatLayouts; | import xyz.veronie.bgg.ui.helpers.BatLayouts; | ||||
| import xyz.veronie.bgg.ui.helpers.ResourceManager; | |||||
| @SuppressWarnings("restriction") | |||||
| public class BatMain { | public class BatMain { | ||||
| private static final String UNNAMED_LIST = "(unsaved list)"; | private static final String UNNAMED_LIST = "(unsaved list)"; | ||||
| @@ -109,7 +108,7 @@ public class BatMain { | |||||
| }); | }); | ||||
| btnFetch.setToolTipText("Fetch games from BGG"); | btnFetch.setToolTipText("Fetch games from BGG"); | ||||
| btnFetch.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/noun_Download_60x60.png")); | |||||
| btnFetch.setImage(ResourceManager.getPluginImageDescriptor("xyz.veronie.bgg.ui", "icons/noun_Download_60x60.png").createImage()); | |||||
| btnSave = new Button(buttonRow, SWT.NONE); | btnSave = new Button(buttonRow, SWT.NONE); | ||||
| btnSave.addMouseListener(new MouseAdapter() { | btnSave.addMouseListener(new MouseAdapter() { | ||||
| @@ -123,7 +122,7 @@ public class BatMain { | |||||
| } | } | ||||
| }); | }); | ||||
| btnSave.setToolTipText("Save list of games"); | btnSave.setToolTipText("Save list of games"); | ||||
| btnSave.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/noun_Save_60x60.png")); | |||||
| btnSave.setImage(ResourceManager.getPluginImageDescriptor("xyz.veronie.bgg.ui", "icons/noun_Save_60x60.png").createImage()); | |||||
| btnSave.setEnabled(false); | btnSave.setEnabled(false); | ||||
| Button btnLoad = new Button(buttonRow, SWT.NONE); | Button btnLoad = new Button(buttonRow, SWT.NONE); | ||||
| @@ -137,14 +136,14 @@ public class BatMain { | |||||
| } | } | ||||
| } | } | ||||
| }); | }); | ||||
| btnLoad.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/noun_open_60x60.png")); | |||||
| btnLoad.setImage(ResourceManager.getPluginImageDescriptor("xyz.veronie.bgg.ui", "icons/noun_open_60x60.png").createImage()); | |||||
| btnLoad.setToolTipText("Load list of games"); | btnLoad.setToolTipText("Load list of games"); | ||||
| btnUndo = new Button(buttonRow, SWT.NONE); | btnUndo = new Button(buttonRow, SWT.NONE); | ||||
| btnUndo.setToolTipText("Undo game list operation"); | btnUndo.setToolTipText("Undo game list operation"); | ||||
| btnUndo.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/noun_Undo_60x60.png")); | |||||
| btnUndo.setImage(ResourceManager.getPluginImageDescriptor("xyz.veronie.bgg.ui", "icons/noun_Undo_60x60.png").createImage()); | |||||
| btnUndo.setEnabled(false); | btnUndo.setEnabled(false); | ||||
| btnExport = new Button(buttonRow, SWT.NONE); | btnExport = new Button(buttonRow, SWT.NONE); | ||||
| @@ -158,7 +157,7 @@ public class BatMain { | |||||
| } | } | ||||
| } | } | ||||
| }); | }); | ||||
| btnExport.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/export_nandeck_60x60.png")); | |||||
| btnExport.setImage(ResourceManager.getPluginImageDescriptor("xyz.veronie.bgg.ui", "icons/export_nandeck_60x60.png").createImage()); | |||||
| btnExport.setToolTipText("Export for nanDeck"); | btnExport.setToolTipText("Export for nanDeck"); | ||||
| btnExport.setEnabled(false); | btnExport.setEnabled(false); | ||||
| @@ -27,8 +27,6 @@ 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.Button; | ||||
| import org.eclipse.swt.widgets.Composite; | import org.eclipse.swt.widgets.Composite; | ||||
| import org.eclipse.wb.swt.ResourceManager; | |||||
| import org.eclipse.wb.swt.SWTResourceManager; | |||||
| import xyz.veronie.bgg.result.BggApi; | import xyz.veronie.bgg.result.BggApi; | ||||
| import xyz.veronie.bgg.result.ResultConfig; | import xyz.veronie.bgg.result.ResultConfig; | ||||
| @@ -43,10 +41,15 @@ import xyz.veronie.bgg.ui.filters.FamilySourceFilter; | |||||
| import xyz.veronie.bgg.ui.filters.GeeklistSourceFilter; | import xyz.veronie.bgg.ui.filters.GeeklistSourceFilter; | ||||
| import xyz.veronie.bgg.ui.helpers.BatColors; | import xyz.veronie.bgg.ui.helpers.BatColors; | ||||
| import xyz.veronie.bgg.ui.helpers.BatLayouts; | import xyz.veronie.bgg.ui.helpers.BatLayouts; | ||||
| import xyz.veronie.bgg.ui.helpers.ResourceManager; | |||||
| import org.eclipse.swt.widgets.Label; | import org.eclipse.swt.widgets.Label; | ||||
| import org.eclipse.tips.ui.internal.util.SWTResourceManager; | |||||
| public class FetchPart { | public class FetchPart { | ||||
| private static final String XYZ_VERONIE_BGG_UI = "xyz.veronie.bgg.ui"; | |||||
| @Inject | @Inject | ||||
| private ResultConfigManager configManager; | private ResultConfigManager configManager; | ||||
| @@ -115,15 +118,15 @@ public class FetchPart { | |||||
| btnBggUser = new Button(buttonRow, SWT.NONE); | btnBggUser = new Button(buttonRow, SWT.NONE); | ||||
| btnBggUser.setToolTipText("Fetch by bgg user"); | btnBggUser.setToolTipText("Fetch by bgg user"); | ||||
| btnBggUser.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/noun_Meeple_60x60.png")); | |||||
| btnBggUser.setImage(ResourceManager.getPluginImageDescriptor(XYZ_VERONIE_BGG_UI, "icons/noun_Meeple_60x60.png").createImage()); | |||||
| btnFamily = new Button(buttonRow, SWT.NONE); | btnFamily = new Button(buttonRow, SWT.NONE); | ||||
| btnFamily.setToolTipText("Fetch by family"); | btnFamily.setToolTipText("Fetch by family"); | ||||
| btnFamily.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/noun_Family_60x60.png")); | |||||
| btnFamily.setImage(ResourceManager.getPluginImageDescriptor(XYZ_VERONIE_BGG_UI, "icons/noun_Family_60x60.png").createImage()); | |||||
| btnGeeklist = new Button(buttonRow, SWT.NONE); | btnGeeklist = new Button(buttonRow, SWT.NONE); | ||||
| btnGeeklist.setToolTipText("Fetch by geeklist"); | btnGeeklist.setToolTipText("Fetch by geeklist"); | ||||
| btnGeeklist.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/noun_List_60x60.png")); | |||||
| btnGeeklist.setImage(ResourceManager.getPluginImageDescriptor(XYZ_VERONIE_BGG_UI, "icons/noun_List_60x60.png").createImage()); | |||||
| centerComposite = new Composite(main, SWT.NONE); | centerComposite = new Composite(main, SWT.NONE); | ||||
| @@ -155,7 +158,7 @@ public class FetchPart { | |||||
| lblResultAction.setText("How do you want to apply the result?"); | lblResultAction.setText("How do you want to apply the result?"); | ||||
| Button btnReplace = new Button(applyComposite, SWT.NONE); | Button btnReplace = new Button(applyComposite, SWT.NONE); | ||||
| btnReplace.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/result_replace_60x60.png")); | |||||
| btnReplace.setImage(ResourceManager.getPluginImageDescriptor(XYZ_VERONIE_BGG_UI, "icons/result_replace_60x60.png").createImage()); | |||||
| btnReplace.setToolTipText("Replace"); | btnReplace.setToolTipText("Replace"); | ||||
| btnReplace.addMouseListener(new MouseAdapter() { | btnReplace.addMouseListener(new MouseAdapter() { | ||||
| @Override | @Override | ||||
| @@ -165,7 +168,7 @@ public class FetchPart { | |||||
| }); | }); | ||||
| Button btnOnlyNew = new Button(applyComposite, SWT.NONE); | Button btnOnlyNew = new Button(applyComposite, SWT.NONE); | ||||
| btnOnlyNew.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/only_new_60x60.png")); | |||||
| btnOnlyNew.setImage(ResourceManager.getPluginImageDescriptor(XYZ_VERONIE_BGG_UI, "icons/only_new_60x60.png").createImage()); | |||||
| btnOnlyNew.setToolTipText("Keep only new"); | btnOnlyNew.setToolTipText("Keep only new"); | ||||
| btnOnlyNew.addMouseListener(new MouseAdapter() { | btnOnlyNew.addMouseListener(new MouseAdapter() { | ||||
| @Override | @Override | ||||
| @@ -175,7 +178,7 @@ public class FetchPart { | |||||
| }); | }); | ||||
| Button btnAdd = new Button(applyComposite, SWT.NONE); | Button btnAdd = new Button(applyComposite, SWT.NONE); | ||||
| btnAdd.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/result_add_60x60.png")); | |||||
| btnAdd.setImage(ResourceManager.getPluginImageDescriptor(XYZ_VERONIE_BGG_UI, "icons/result_add_60x60.png").createImage()); | |||||
| btnAdd.setToolTipText("Add"); | btnAdd.setToolTipText("Add"); | ||||
| btnAdd.addMouseListener(new MouseAdapter() { | btnAdd.addMouseListener(new MouseAdapter() { | ||||
| @Override | @Override | ||||
| @@ -185,7 +188,7 @@ public class FetchPart { | |||||
| }); | }); | ||||
| Button btnIntersect = new Button(applyComposite, SWT.NONE); | Button btnIntersect = new Button(applyComposite, SWT.NONE); | ||||
| btnIntersect.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/result_intersect_60x60.png")); | |||||
| btnIntersect.setImage(ResourceManager.getPluginImageDescriptor(XYZ_VERONIE_BGG_UI, "icons/result_intersect_60x60.png").createImage()); | |||||
| btnIntersect.setToolTipText("Intersect"); | btnIntersect.setToolTipText("Intersect"); | ||||
| btnIntersect.addMouseListener(new MouseAdapter() { | btnIntersect.addMouseListener(new MouseAdapter() { | ||||
| @Override | @Override | ||||
| @@ -195,7 +198,7 @@ public class FetchPart { | |||||
| }); | }); | ||||
| Button btnSubtract = new Button(applyComposite, SWT.NONE); | Button btnSubtract = new Button(applyComposite, SWT.NONE); | ||||
| btnSubtract.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/result_subtract_60x60.png")); | |||||
| btnSubtract.setImage(ResourceManager.getPluginImageDescriptor(XYZ_VERONIE_BGG_UI, "icons/result_subtract_60x60.png").createImage()); | |||||
| btnSubtract.setToolTipText("Subtract"); | btnSubtract.setToolTipText("Subtract"); | ||||
| btnSubtract.addMouseListener(new MouseAdapter() { | btnSubtract.addMouseListener(new MouseAdapter() { | ||||
| @Override | @Override | ||||