SlideShare a Scribd company logo
OSGi & Eclipse RCP
Eric Jain
Seattle Java User Group, November 15, 2011
OSGi and Eclipse RCP
1 acctggat...
2 acctgaat...
3 acctggag...
1 A*24:36N
2 A*02:01:21
3 A*03:20/A*11:86
Samples


                                                                             1 A*24:36N
                                                                             2 A*02:01:21
                                                                             3 A*03:20/A*11:86




                                                                      Resolution
     Quantification
                                                    Sequencing




Extraction    Normalization     Amplification
                                                                                   SNP-Calling   Genotyping



                                                QC Failure / Repeat
             Other Workflows
OSGi and Eclipse RCP
OSGi and Eclipse RCP
OSGi and Eclipse RCP
OSGi and Eclipse RCP
OSGi and Eclipse RCP
OSGi and Eclipse RCP
OSGi and Eclipse RCP
OSGi and Eclipse RCP
OSGi and Eclipse RCP
OSGi and Eclipse RCP
standalone              client

              ui
h2                           fs-proxy

              logging

       fs
              core      pg
     exec



              fs-http


             server
Workflow A
                                                      (v2)




                                      SNP
                   Sequencing                      Workflow A
                                     Calling           (v1)
                           1.0.0




Amplification



                Sequencing
                   2.0.0


                                      SNP
                                   Discovery



                                                 Workflow B
META-INF/MANIFEST.MF




Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Demo Bundle
Bundle-SymbolicName: org.seajug.demo
Bundle-Version: 1.0.0
Import-Package:
 com.google.common.base;version="[10.0.0,11.0.0)",
 com.google.common.collect;version="[10.0.0,11.0.0)",
 com.google.common.io;version="[10.0.0,11.0.0)"
Export-Package:
 org.seajug.demo;version="1.0.0",
 org.seajug.demo.ui;version="1.0.0"
Bundle-ClassPath: lib/jxl.jar, conf/, .
Bundle-Activator: org.seajug.demo.Activator
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bootstrap CL


            Extensions CL


       System Classpath CL



Context 1    Context 2      Context 3
Bootstrap CL


           Extensions CL


      System Classpath CL




             Bundle 2



Bundle 1                   Bundle 3
                           Fragment A


             Bundle 4
OSGi and Eclipse RCP
osgi> ss

Framework is launched.

id    State      Bundle
0     ACTIVE     org.eclipse.osgi_3.7.1.R37x_v20110808-1106
                 Fragments=1
1     RESOLVED   org.eclipse.equinox.weaving.hook_1.0.0.v20100108
                 Master=0
2     ACTIVE     org.eclipse.equinox.simpleconfigurator_1.0.200.v20110502
3     RESOLVED   ch.qos.logback.classic_0.9.29
                 Fragments=98
4     RESOLVED   ch.qos.logback.core_0.9.29
5     RESOLVED   com.google.guava_10.0.0
...
53    <<LAZY>>   org.eclipse.emf.ecore_2.7.0.v20110912-0920
...
78    RESOLVED   org.eclipse.swt_3.7.1.v3738a
                 Fragments=79
79    RESOLVED   org.eclipse.swt.win32.win32.x86_64_3.7.1.v3738a
                 Master=78
...
From: Creating Modular Applications in Java. Manning, 2011.
Activator.java




package org.seajug.demo;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;

public class Activator implements BundleActivator {

    @Override
    public void start(BundleContext context) {
      context.registerService(Foo.class, new Foo(), null);
      ServiceReference<Bar> ref =
        context.getServiceReference(Bar.class);
      Bar bar = (Bar) context.getService(ref);
      ...
    }

    @Override
    public void stop(BundleContext context) {

    }
}
META-INF/spring-context.xml




<?xml version="1.0" encoding="UTF-8"?>

<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:osgi="http://www.springframework.org/schema/osgi"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="..."
>

 <osgi:reference id="foo" interface="org.seajug.demo.Foo"/>

 <bean id="bar" class="org.seajug.demo.internal.BarImpl"/>

 <osgi:service ref="bar" interface="org.seajug.demo.Bar"/>

 <context:annotation-config/>

</beans>
OSGi and Eclipse RCP
pom.xml
<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-bundle-plugin</artifactId>
  <version>2.1.0</version>
  <configuration>
    <instructions>
      <module>com.google.inject</module>
      <Bundle-Copyright>Copyright (C) 2006 Google Inc.</Bundle-Copyright>
      <Bundle-DocURL>http://code.google.com/p/google-guice/</Bundle-DocURL>
      <Bundle-Name>${project.artifactId}</Bundle-Name>
      <Bundle-SymbolicName>$(module)</Bundle-SymbolicName>
      <Bundle-RequiredExecutionEnvironment>
        J2SE-1.5,JavaSE-1.6
      </Bundle-RequiredExecutionEnvironment>
      <Import-Package>!com.google.inject.*,*</Import-Package>
      <_versionpolicy>
        [$(version;==;$(@)),$(version;+;$(@)))
      </_versionpolicy>
    </instructions>
  </configuration>
  <executions>
    <execution>
      <phase>prepare-package</phase>
      <goals>
        <goal>manifest</goal>
      </goals>
    </execution>
  </executions>
</plugin>
module-info.java




module com.greetings @ 0.1 {
    requires jdk.base; // default to the highest available version
    requires org.astro @ 1.[1.1.1]+;
    class com.greetings.Hello;
}}




                                  http://openjdk.java.net/projects/jigsaw/
TableDemo.java




package org.seajug.demo;

import   org.eclipse.swt.SWT;
import   org.eclipse.swt.widgets.Composite;
import   org.eclipse.swt.widgets.Table;
import   org.eclipse.swt.widgets.TableItem;

public class TableDemo {

    public void show(String[] values, Composite parent) {
      Table table = new Table(parent, SWT.BORDER | SWT.V_SCROLL);
      for (String value : values) {
        TableItem item = new TableItem(table, SWT.NONE);
        item.setText(value);
      }
    }
}
TableViewerDemo.java




package org.seajug.demo;

import   org.eclipse.jface.viewers.ArrayContentProvider;
import   org.eclipse.jface.viewers.LabelProvider;
import   org.eclipse.jface.viewers.TableViewer;
import   org.eclipse.swt.SWT;
import   org.eclipse.swt.widgets.Composite;

public class TableViewerDemo {

    public void show(String[] values, Composite parent) {
      TableViewer viewer = new TableViewer(parent, SWT.BORDER | SWT.V_SCROLL);
      viewer.setLabelProvider(new LabelProvider());
      viewer.setContentProvider(new ArrayContentProvider());
      viewer.setInput(values);
    }
}
TableViewPartDemo.java

package org.seajug.demo;

import   org.eclipse.jface.viewers.TableViewer;
import   org.eclipse.swt.widgets.Composite;
import   org.eclipse.ui.IViewSite;
import   org.eclipse.ui.PartInitException;
import   org.eclipse.ui.part.ViewPart;

public class DemoViewPart extends ViewPart {

    private TableViewer viewer;

    @Override
    public void init(IViewSite site) throws PartInitException {
      super.init(site);
    }

    @Override
    public void createPartControl(Composite parent) {
      viewer = new TableViewer(parent, SWT.BORDER | SWT.V_SCROLL);
      ...
    }

    @Override
    public void setFocus() {
      viewer.getControl().setFocus();
    }

    @Override
    public void dispose() {
      super.dispose();
    }
}
plugin.xml



<extension point="org.eclipse.ui.views">
  <view
     id="demoView"
     name="Demo"
     class="org.seajug.demo.DemoViewPart"
  />
</extension>
plugin.xml


<extension point="org.eclipse.ui.commands">
  <command id="openItem" name="Open Item"/>
</extension>

<extension point="org.eclipse.ui.handlers">
  <handler class="org.seajug.demo.OpenItemHandler" commandId="openItem">
    <activeWhen>
      <with variable="activePartId">
        <equals value="demoView"/>
      </with>
    </activeWhen>
    <enabledWhen>
      <with variable="selection">
        <and>
          <count value="1"/>
          <iterate>
             <instanceof value="org.seajug.demo.Item"/>
          </iterate>
        </and>
      </with>
    </enabledWhen>
  </handler>
</extension>

<extension point="org.eclipse.ui.menus">
  <menuContribution locationURI="toolbar:demoView">
    <command commandId="openItem" icon="icons/open.png" style="push"/>
  </menuContribution>
</extension>
OSGi and Eclipse RCP
OSGi and Eclipse RCP
package org.fhcrc.gems.ui;

import   org.eclipse.core.runtime.IProgressMonitor;
import   org.eclipse.core.runtime.IStatus;
import   org.eclipse.core.runtime.Status;
import   org.eclipse.core.runtime.jobs.Job;

public class JobDemo {

    public void run() {
      new Job("Genotyping") {
        @Override
        protected IStatus run(IProgressMonitor monitor) {
          monitor.beginTask("Reticulating splines", 100);
          for (int i = 0; i < 100; ++i) {
            if (monitor.isCanceled()) {
              return Status.CANCEL_STATUS;
            }
            ...
          }
          monitor.done();
          return Status.OK_STATUS;
        }
      }.schedule();
    }
}
OSGi and Eclipse RCP
pom.xml
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0">

 <modelVersion>4.0.0</modelVersion>

 <groupId>org.seajug.demo</groupId>
 <artifactId>parent</artifactId>
 <version>1.0.0-SNAPSHOT</version>
 <packaging>pom</packaging>

 <properties>
   <tycho-version>0.13.0</tycho-version>
 </properties>

 <modules>
   <module>product</module>
   <module>org.seajug.demo.core</module>
   <module>org.seajug.demo.feature</module>
   <module>org.seajug.demo.test</module>
   <module>target-definition</module>
 </modules>

 <build>
   <plugins>
     <plugin>
       <groupId>org.eclipse.tycho</groupId>
       <artifactId>tycho-maven-plugin</artifactId>
       <version>${tycho-version}</version>
       <extensions>true</extensions>
     </plugin>
     <plugin>
       <groupId>org.eclipse.tycho</groupId>
       <artifactId>target-platform-configuration</artifactId>
       <version>${tycho-version}</version>
       <configuration>
          <resolver>p2</resolver>
          <target>
            <artifact>
              <groupId>org.seajug.demo</groupId>
              <artifactId>target-definition</artifactId>
              <version>1.0.0-SNAPSHOT</version>
              <classifier>build</classifier>
            </artifact>
          </target>
       </configuration>
     </plugin>
   </plugins>
 </build>
org.seajug.demo.core/pom.xml




<project xmlns="http://maven.apache.org/POM/4.0.0">

 <modelVersion>4.0.0</modelVersion>

 <groupId>org.seajug.demo</groupId>
 <artifactId>org.seajug.demo.core</artifactId>
 <version>1.0.0-SNAPSHOT</version>
 <packaging>eclipse-plugin</packaging>

 <parent>
   <groupId>org.seajug.demo</groupId>
   <artifactId>parent</artifactId>
   <version>1.0.0-SNAPSHOT</version>
 </parent>

</project>
OSGi and Eclipse RCP
OSGi and Eclipse RCP
OSGi and Eclipse RCP

More Related Content

PDF
Java设置环境变量
PPTX
Jdk(java) 7 - 6 기타기능
ODP
To inject or not to inject: CDI is the question
PDF
Indic threads pune12-java ee 7 platformsimplification html5
PDF
Custom deployments with sbt-native-packager
PDF
50 new features of Java EE 7 in 50 minutes
PDF
React, Redux and es6/7
PDF
Testing Your Application On Google App Engine
Java设置环境变量
Jdk(java) 7 - 6 기타기능
To inject or not to inject: CDI is the question
Indic threads pune12-java ee 7 platformsimplification html5
Custom deployments with sbt-native-packager
50 new features of Java EE 7 in 50 minutes
React, Redux and es6/7
Testing Your Application On Google App Engine

What's hot (20)

PDF
Тестирование на Android с Dagger 2
PDF
Java8 tgtbatu javaone
PDF
Vaadin 7
PDF
Java(8) The Good, The Bad and the Ugly
PDF
Making the most of your gradle build - Gr8Conf 2017
PDF
Making the most of your gradle build - Greach 2017
PDF
Tomcat连接池配置方法V2.1
PDF
#11.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원학원,재직자/실업자교육학원,스프링교육,마이바...
PDF
Easy REST APIs with Jersey and RestyGWT
PPTX
Jersey framework
PDF
Clojure - A new Lisp
PDF
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai University
PDF
The Ring programming language version 1.10 book - Part 94 of 212
PDF
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
PDF
Java 7 LavaJUG
PDF
Google I/O 2021 Recap
PDF
Turbo Charged Test Suites
DOCX
Ejemplo radio
PDF
Under the Hood: Using Spring in Grails
TXT
Hello click click boom
Тестирование на Android с Dagger 2
Java8 tgtbatu javaone
Vaadin 7
Java(8) The Good, The Bad and the Ugly
Making the most of your gradle build - Gr8Conf 2017
Making the most of your gradle build - Greach 2017
Tomcat连接池配置方法V2.1
#11.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원학원,재직자/실업자교육학원,스프링교육,마이바...
Easy REST APIs with Jersey and RestyGWT
Jersey framework
Clojure - A new Lisp
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai University
The Ring programming language version 1.10 book - Part 94 of 212
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 LavaJUG
Google I/O 2021 Recap
Turbo Charged Test Suites
Ejemplo radio
Under the Hood: Using Spring in Grails
Hello click click boom
Ad

Viewers also liked (11)

PPT
Eclipse Plug-in Develompent Tips And Tricks
PPTX
Eclipse RCP 4
KEY
OSGi For Eclipse Developers
ODP
Eclipse Extensions Vs OSGI Services Tikal@ EclipseDemoCamps Tel Aviv
PDF
OSGi Technology, Eclipse and Convergence - Jeff McAffer, IBM
KEY
OSGi, Eclipse and API Tooling
ODP
PDE Good Practices
PPTX
Intro to OSGi and Eclipse Virgo
PDF
Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!
PDF
Eclipse plug in development
PDF
The Eclipse IDE - The Force Awakens (Devoxx France 2016)
Eclipse Plug-in Develompent Tips And Tricks
Eclipse RCP 4
OSGi For Eclipse Developers
Eclipse Extensions Vs OSGI Services Tikal@ EclipseDemoCamps Tel Aviv
OSGi Technology, Eclipse and Convergence - Jeff McAffer, IBM
OSGi, Eclipse and API Tooling
PDE Good Practices
Intro to OSGi and Eclipse Virgo
Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!
Eclipse plug in development
The Eclipse IDE - The Force Awakens (Devoxx France 2016)
Ad

Similar to OSGi and Eclipse RCP (20)

KEY
企业级软件的组件化和动态化开发实践
PPTX
EclipseCON2012 - Enterprise OSGi for Earthlings: Meet Eclipse Libra
PDF
Weld-OSGi, injecting easiness in OSGi
PDF
Introduction to OSGi (Tokyo JUG)
PDF
Introduction to clarity
PDF
Extending and scripting PDT
PDF
1006 Z2 Intro Complete
KEY
Eclipse meets e4
PDF
Demistifying OSGi - Colombo Java Meetup 2013
PDF
Demistifying OSGi
PDF
Of Bugs and Men
PDF
Of Bugs and Men (and Plugins too)
ODP
03 osgi and servicemix
PDF
OSGi overview
PDF
Spring 3 - Der dritte Frühling
PDF
JavaOne 2010: OSGI Migrat
PDF
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
PDF
Eclipse vs Netbean vs Railo
PDF
OSGi Best Practices - Tim Ward
PDF
JavaOne 2012, OSGi for the Earthlings: Meet Eclipse Libra
企业级软件的组件化和动态化开发实践
EclipseCON2012 - Enterprise OSGi for Earthlings: Meet Eclipse Libra
Weld-OSGi, injecting easiness in OSGi
Introduction to OSGi (Tokyo JUG)
Introduction to clarity
Extending and scripting PDT
1006 Z2 Intro Complete
Eclipse meets e4
Demistifying OSGi - Colombo Java Meetup 2013
Demistifying OSGi
Of Bugs and Men
Of Bugs and Men (and Plugins too)
03 osgi and servicemix
OSGi overview
Spring 3 - Der dritte Frühling
JavaOne 2010: OSGI Migrat
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
Eclipse vs Netbean vs Railo
OSGi Best Practices - Tim Ward
JavaOne 2012, OSGi for the Earthlings: Meet Eclipse Libra

More from Eric Jain (6)

PDF
Image classification with Deeplearning4j
PDF
Combining your data with Zenobase
PDF
Java Time Puzzlers
PPT
beta.uniprot.org - 5 Lessons Learned
PPT
UniProt REST API
PPT
UniProt & Ontologies
Image classification with Deeplearning4j
Combining your data with Zenobase
Java Time Puzzlers
beta.uniprot.org - 5 Lessons Learned
UniProt REST API
UniProt & Ontologies

Recently uploaded (20)

PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Spectroscopy.pptx food analysis technology
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Electronic commerce courselecture one. Pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Chapter 3 Spatial Domain Image Processing.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
“AI and Expert System Decision Support & Business Intelligence Systems”
Empathic Computing: Creating Shared Understanding
Spectroscopy.pptx food analysis technology
NewMind AI Weekly Chronicles - August'25 Week I
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
The AUB Centre for AI in Media Proposal.docx
MYSQL Presentation for SQL database connectivity
Review of recent advances in non-invasive hemoglobin estimation
Encapsulation_ Review paper, used for researhc scholars
sap open course for s4hana steps from ECC to s4
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Network Security Unit 5.pdf for BCA BBA.
Electronic commerce courselecture one. Pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Chapter 3 Spatial Domain Image Processing.pdf

OSGi and Eclipse RCP

  • 1. OSGi & Eclipse RCP Eric Jain Seattle Java User Group, November 15, 2011
  • 4. 1 A*24:36N 2 A*02:01:21 3 A*03:20/A*11:86
  • 5. Samples 1 A*24:36N 2 A*02:01:21 3 A*03:20/A*11:86 Resolution Quantification Sequencing Extraction Normalization Amplification SNP-Calling Genotyping QC Failure / Repeat Other Workflows
  • 16. standalone client ui h2 fs-proxy logging fs core pg exec fs-http server
  • 17. Workflow A (v2) SNP Sequencing Workflow A Calling (v1) 1.0.0 Amplification Sequencing 2.0.0 SNP Discovery Workflow B
  • 18. META-INF/MANIFEST.MF Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Demo Bundle Bundle-SymbolicName: org.seajug.demo Bundle-Version: 1.0.0 Import-Package: com.google.common.base;version="[10.0.0,11.0.0)", com.google.common.collect;version="[10.0.0,11.0.0)", com.google.common.io;version="[10.0.0,11.0.0)" Export-Package: org.seajug.demo;version="1.0.0", org.seajug.demo.ui;version="1.0.0" Bundle-ClassPath: lib/jxl.jar, conf/, . Bundle-Activator: org.seajug.demo.Activator Bundle-RequiredExecutionEnvironment: JavaSE-1.6
  • 19. Bootstrap CL Extensions CL System Classpath CL Context 1 Context 2 Context 3
  • 20. Bootstrap CL Extensions CL System Classpath CL Bundle 2 Bundle 1 Bundle 3 Fragment A Bundle 4
  • 22. osgi> ss Framework is launched. id State Bundle 0 ACTIVE org.eclipse.osgi_3.7.1.R37x_v20110808-1106 Fragments=1 1 RESOLVED org.eclipse.equinox.weaving.hook_1.0.0.v20100108 Master=0 2 ACTIVE org.eclipse.equinox.simpleconfigurator_1.0.200.v20110502 3 RESOLVED ch.qos.logback.classic_0.9.29 Fragments=98 4 RESOLVED ch.qos.logback.core_0.9.29 5 RESOLVED com.google.guava_10.0.0 ... 53 <<LAZY>> org.eclipse.emf.ecore_2.7.0.v20110912-0920 ... 78 RESOLVED org.eclipse.swt_3.7.1.v3738a Fragments=79 79 RESOLVED org.eclipse.swt.win32.win32.x86_64_3.7.1.v3738a Master=78 ...
  • 23. From: Creating Modular Applications in Java. Manning, 2011.
  • 24. Activator.java package org.seajug.demo; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; public class Activator implements BundleActivator { @Override public void start(BundleContext context) { context.registerService(Foo.class, new Foo(), null); ServiceReference<Bar> ref = context.getServiceReference(Bar.class); Bar bar = (Bar) context.getService(ref); ... } @Override public void stop(BundleContext context) { } }
  • 25. META-INF/spring-context.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:osgi="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="..." > <osgi:reference id="foo" interface="org.seajug.demo.Foo"/> <bean id="bar" class="org.seajug.demo.internal.BarImpl"/> <osgi:service ref="bar" interface="org.seajug.demo.Bar"/> <context:annotation-config/> </beans>
  • 27. pom.xml <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>2.1.0</version> <configuration> <instructions> <module>com.google.inject</module> <Bundle-Copyright>Copyright (C) 2006 Google Inc.</Bundle-Copyright> <Bundle-DocURL>http://code.google.com/p/google-guice/</Bundle-DocURL> <Bundle-Name>${project.artifactId}</Bundle-Name> <Bundle-SymbolicName>$(module)</Bundle-SymbolicName> <Bundle-RequiredExecutionEnvironment> J2SE-1.5,JavaSE-1.6 </Bundle-RequiredExecutionEnvironment> <Import-Package>!com.google.inject.*,*</Import-Package> <_versionpolicy> [$(version;==;$(@)),$(version;+;$(@))) </_versionpolicy> </instructions> </configuration> <executions> <execution> <phase>prepare-package</phase> <goals> <goal>manifest</goal> </goals> </execution> </executions> </plugin>
  • 28. module-info.java module com.greetings @ 0.1 { requires jdk.base; // default to the highest available version requires org.astro @ 1.[1.1.1]+; class com.greetings.Hello; }} http://openjdk.java.net/projects/jigsaw/
  • 29. TableDemo.java package org.seajug.demo; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableItem; public class TableDemo { public void show(String[] values, Composite parent) { Table table = new Table(parent, SWT.BORDER | SWT.V_SCROLL); for (String value : values) { TableItem item = new TableItem(table, SWT.NONE); item.setText(value); } } }
  • 30. TableViewerDemo.java package org.seajug.demo; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; public class TableViewerDemo { public void show(String[] values, Composite parent) { TableViewer viewer = new TableViewer(parent, SWT.BORDER | SWT.V_SCROLL); viewer.setLabelProvider(new LabelProvider()); viewer.setContentProvider(new ArrayContentProvider()); viewer.setInput(values); } }
  • 31. TableViewPartDemo.java package org.seajug.demo; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IViewSite; import org.eclipse.ui.PartInitException; import org.eclipse.ui.part.ViewPart; public class DemoViewPart extends ViewPart { private TableViewer viewer; @Override public void init(IViewSite site) throws PartInitException { super.init(site); } @Override public void createPartControl(Composite parent) { viewer = new TableViewer(parent, SWT.BORDER | SWT.V_SCROLL); ... } @Override public void setFocus() { viewer.getControl().setFocus(); } @Override public void dispose() { super.dispose(); } }
  • 32. plugin.xml <extension point="org.eclipse.ui.views"> <view id="demoView" name="Demo" class="org.seajug.demo.DemoViewPart" /> </extension>
  • 33. plugin.xml <extension point="org.eclipse.ui.commands"> <command id="openItem" name="Open Item"/> </extension> <extension point="org.eclipse.ui.handlers"> <handler class="org.seajug.demo.OpenItemHandler" commandId="openItem"> <activeWhen> <with variable="activePartId"> <equals value="demoView"/> </with> </activeWhen> <enabledWhen> <with variable="selection"> <and> <count value="1"/> <iterate> <instanceof value="org.seajug.demo.Item"/> </iterate> </and> </with> </enabledWhen> </handler> </extension> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="toolbar:demoView"> <command commandId="openItem" icon="icons/open.png" style="push"/> </menuContribution> </extension>
  • 36. package org.fhcrc.gems.ui; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; public class JobDemo { public void run() { new Job("Genotyping") { @Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask("Reticulating splines", 100); for (int i = 0; i < 100; ++i) { if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } ... } monitor.done(); return Status.OK_STATUS; } }.schedule(); } }
  • 38. pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"> <modelVersion>4.0.0</modelVersion> <groupId>org.seajug.demo</groupId> <artifactId>parent</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>pom</packaging> <properties> <tycho-version>0.13.0</tycho-version> </properties> <modules> <module>product</module> <module>org.seajug.demo.core</module> <module>org.seajug.demo.feature</module> <module>org.seajug.demo.test</module> <module>target-definition</module> </modules> <build> <plugins> <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-maven-plugin</artifactId> <version>${tycho-version}</version> <extensions>true</extensions> </plugin> <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>target-platform-configuration</artifactId> <version>${tycho-version}</version> <configuration> <resolver>p2</resolver> <target> <artifact> <groupId>org.seajug.demo</groupId> <artifactId>target-definition</artifactId> <version>1.0.0-SNAPSHOT</version> <classifier>build</classifier> </artifact> </target> </configuration> </plugin> </plugins> </build>
  • 39. org.seajug.demo.core/pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0"> <modelVersion>4.0.0</modelVersion> <groupId>org.seajug.demo</groupId> <artifactId>org.seajug.demo.core</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> <parent> <groupId>org.seajug.demo</groupId> <artifactId>parent</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> </project>