Author: rozagh
Date: 2012-06-25 14:52:27 -0700 (Mon, 25 Jun 2012)
New Revision: 29684

Added:
   core3/samples/trunk/sample24/
   core3/samples/trunk/sample24/pom.xml
   core3/samples/trunk/sample24/src/
   core3/samples/trunk/sample24/src/main/
   core3/samples/trunk/sample24/src/main/java/
   core3/samples/trunk/sample24/src/main/java/org/
   core3/samples/trunk/sample24/src/main/java/org/cytoscape/
   core3/samples/trunk/sample24/src/main/java/org/cytoscape/sample/
   core3/samples/trunk/sample24/src/main/java/org/cytoscape/sample/sample24/
   
core3/samples/trunk/sample24/src/main/java/org/cytoscape/sample/sample24/internal/
   
core3/samples/trunk/sample24/src/main/java/org/cytoscape/sample/sample24/internal/CyActivator.java
   
core3/samples/trunk/sample24/src/main/java/org/cytoscape/sample/sample24/internal/MenuAction.java
   core3/samples/trunk/sample24/src/main/resources/
   core3/samples/trunk/sample24/src/main/resources/help/
   core3/samples/trunk/sample24/src/main/resources/help/SubTopic.html
   core3/samples/trunk/sample24/src/main/resources/help/Topic.html
   core3/samples/trunk/sample24/src/main/resources/help/images/
   core3/samples/trunk/sample24/src/main/resources/help/jhelpmap.jhm
   core3/samples/trunk/sample24/src/main/resources/help/jhelpset.hs
   core3/samples/trunk/sample24/src/main/resources/help/jhelptoc.xml
Modified:
   
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/CyActivator.java
Log:
fixes #1160 added the sample file for writing app help. Registered CyHelpBroker 
service in swing-application-impl

Modified: 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/CyActivator.java
===================================================================
--- 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/CyActivator.java
       2012-06-25 21:37:20 UTC (rev 29683)
+++ 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/CyActivator.java
       2012-06-25 21:52:27 UTC (rev 29684)
@@ -55,6 +55,7 @@
 import org.cytoscape.application.events.CyShutdownListener;
 import org.cytoscape.application.events.SetCurrentNetworkViewListener;
 import org.cytoscape.application.swing.CyAction;
+import org.cytoscape.application.swing.CyHelpBroker;
 import org.cytoscape.application.swing.CytoPanelComponent;
 import org.cytoscape.application.swing.ToolBarComponent;
 import org.cytoscape.event.CyEventHelper;
@@ -278,7 +279,8 @@
                                                                                
     sessionReaderManagerServiceRef,
                                                                                
     cyApplicationManagerServiceRef);
 
-
+               
+               registerService(bc, cyHelpBroker, CyHelpBroker.class, new 
Properties());
                registerService(bc, undoAction, CyAction.class, new 
Properties());
                registerService(bc, redoAction, CyAction.class, new 
Properties());
                registerService(bc, printAction, CyAction.class, new 
Properties());

Added: core3/samples/trunk/sample24/pom.xml
===================================================================
--- core3/samples/trunk/sample24/pom.xml                                (rev 0)
+++ core3/samples/trunk/sample24/pom.xml        2012-06-25 21:52:27 UTC (rev 
29684)
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+       <properties>
+                                               
<bundle.symbolicName>org.cytoscape.sample.sample24</bundle.symbolicName>
+               
<bundle.namespace>org.cytoscape.sample.sample24</bundle.namespace>
+       </properties>
+
+       <modelVersion>4.0.0</modelVersion>
+       <groupId>org.cytoscape.sample</groupId>
+       <artifactId>sample24</artifactId>
+       <version>0.0.1-SNAPSHOT</version>
+
+                       <name>${bundle.symbolicName}</name>
+       
+       <packaging>bundle</packaging>
+
+       <build>
+               <resources>
+                       <resource>
+                               <directory>src/main/resources</directory>
+                       </resource>
+               </resources>
+               <!-- Cytoscape requires Java 1.6 -->
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-compiler-plugin</artifactId>
+                               <version>2.3.2</version>
+                               <executions>
+                                       <execution>
+                                               <id>default-testCompile</id>
+                                               <phase>test-compile</phase>
+                                               <goals>
+                                                       <goal>testCompile</goal>
+                                               </goals>
+                                       </execution>
+                                       <execution>
+                                               <id>default-compile</id>
+                                               <phase>compile</phase>
+                                               <goals>
+                                                       <goal>compile</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                               <configuration>
+                                       <source>1.6</source>
+                                       <target>1.6</target>
+                                       <optimize>true</optimize>
+                                       <showWarnings>true</showWarnings>
+                                       <showDeprecation>true</showDeprecation>
+                                       <compilerArguments>
+                                               <Xmaxwarns>10000</Xmaxwarns>
+                                               <Xmaxerrs>10000</Xmaxerrs>
+                                       </compilerArguments>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-surefire-plugin</artifactId>
+                               <version>2.7.1</version>
+                               <configuration>
+                                       
<redirectTestOutputToFile>true</redirectTestOutputToFile>
+                               </configuration>
+                       </plugin>
+                       <!-- Generates the OSGi metadata based on the osgi.bnd 
file. -->
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-bundle-plugin</artifactId>
+                               <version>2.3.7</version>
+                               <extensions>true</extensions>
+                               <configuration>
+                                       <instructions>
+                                                                               
                
<Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
+                                               
<Bundle-Version>${project.version}</Bundle-Version>
+                                               
<Export-Package>${bundle.namespace}</Export-Package>
+                                               
<Private-Package>${bundle.namespace}.internal.*</Private-Package>
+                                               
<Bundle-Activator>${bundle.namespace}.internal.CyActivator</Bundle-Activator>
+                                                                               
        </instructions>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+
+       <!-- Links to the Cytoscape Maven repositories. -->
+       <repositories>
+               <repository>
+                       <id>cytoscape_snapshots</id>
+                       <snapshots>
+                       </snapshots>
+                       <releases>
+                               <enabled>false</enabled>
+                       </releases>
+                       <name>Cytoscape Snapshots</name>
+                       
<url>http://code.cytoscape.org/nexus/content/repositories/snapshots/</url>
+               </repository>
+               <repository>
+                       <id>cytoscape_releases</id>
+                       <snapshots>
+                               <enabled>false</enabled>
+                       </snapshots>
+                       <releases>
+                       </releases>
+                       <name>Cytoscape Releases</name>
+                       
<url>http://code.cytoscape.org/nexus/content/repositories/releases/</url>
+               </repository>
+               <repository>
+                       <id>cytoscape_third_party</id>
+                       <snapshots>
+                               <enabled>false</enabled>
+                       </snapshots>
+                       <releases>
+                       </releases>
+                       <name>Cytoscape Third Party</name>
+                       
<url>http://code.cytoscape.org/nexus/content/repositories/thirdparty/</url>
+               </repository>
+       </repositories>
+       <!-- Dependencies needed to compile this project. -->
+       <dependencies>
+               <dependency>
+                       <groupId>org.osgi</groupId>
+                       <artifactId>org.osgi.core</artifactId>
+                       <version>4.2.0</version>
+               </dependency>
+               
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>service-api</artifactId>
+                       <version>[3.0.0-alpha7,4.0)</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>swing-application-api</artifactId>
+                       <version>[3.0.0-alpha7,4.0)</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>session-api</artifactId>
+                       <version>[3.0.0-alpha7,4.0)</version>
+               </dependency>
+
+               <dependency>
+                       <groupId>cytoscape-sun</groupId>
+                       <artifactId>jhall</artifactId>
+                       <version>1.0</version>
+               </dependency>
+               <!-- Logging -->
+               <dependency>
+                       <groupId>org.ops4j.pax.logging</groupId>
+                       <artifactId>pax-logging-api</artifactId>
+                       <version>1.5.2</version>
+                       <scope>provided</scope>
+               </dependency>
+
+       </dependencies>
+
+</project>

Added: 
core3/samples/trunk/sample24/src/main/java/org/cytoscape/sample/sample24/internal/CyActivator.java
===================================================================
--- 
core3/samples/trunk/sample24/src/main/java/org/cytoscape/sample/sample24/internal/CyActivator.java
                          (rev 0)
+++ 
core3/samples/trunk/sample24/src/main/java/org/cytoscape/sample/sample24/internal/CyActivator.java
  2012-06-25 21:52:27 UTC (rev 29684)
@@ -0,0 +1,26 @@
+package org.cytoscape.sample.sample24.internal;
+
+import java.util.Properties;
+
+import org.cytoscape.application.CyApplicationManager;
+import org.cytoscape.application.swing.CyHelpBroker;
+import org.cytoscape.event.CyEventHelper;
+import org.cytoscape.service.util.AbstractCyActivator;
+import org.osgi.framework.BundleContext;
+
+public class CyActivator extends AbstractCyActivator {
+
+       @Override
+       public void start(BundleContext context) throws Exception {
+               
+               CyApplicationManager cyApplicationManager = getService(context, 
CyApplicationManager.class);
+               CyHelpBroker cyHelpBroker = getService(context, 
CyHelpBroker.class);
+
+               MenuAction action = new MenuAction(cyHelpBroker);
+               
+               Properties properties = new Properties();
+               
+               registerAllServices(context, action, properties);
+       }
+
+}

Added: 
core3/samples/trunk/sample24/src/main/java/org/cytoscape/sample/sample24/internal/MenuAction.java
===================================================================
--- 
core3/samples/trunk/sample24/src/main/java/org/cytoscape/sample/sample24/internal/MenuAction.java
                           (rev 0)
+++ 
core3/samples/trunk/sample24/src/main/java/org/cytoscape/sample/sample24/internal/MenuAction.java
   2012-06-25 21:52:27 UTC (rev 29684)
@@ -0,0 +1,37 @@
+package org.cytoscape.sample.sample24.internal;
+
+import java.awt.event.ActionEvent;
+import java.net.URL;
+import org.cytoscape.application.swing.CyHelpBroker;
+import javax.help.HelpSet;
+
+
+/**
+ * Creates a new menu item under Apps menu section.
+ *
+ */
+public class MenuAction {
+
+       private final CyHelpBroker cyHelpBroker;
+       public MenuAction(CyHelpBroker cyHelpBroker) {
+               this.cyHelpBroker = cyHelpBroker;
+               
+               addHelp();
+       }
+
+       /**
+        *  Hook plugin help into the Cytoscape main help system:
+        */
+       private void addHelp() {
+               final String HELP_SET_NAME = "/help/jhelpset";
+               final ClassLoader classLoader = 
MenuAction.class.getClassLoader();
+               URL helpSetURL;
+               try {
+                       helpSetURL = HelpSet.findHelpSet(classLoader, 
HELP_SET_NAME);
+                       final HelpSet newHelpSet = new HelpSet(classLoader, 
helpSetURL);
+                       cyHelpBroker.getHelpSet().add(newHelpSet);
+               } catch (final Exception e) {
+                       System.err.println("Sample24: Could not find help set: 
\"" + HELP_SET_NAME + "!");
+               }
+       }
+}

Added: core3/samples/trunk/sample24/src/main/resources/help/SubTopic.html
===================================================================
--- core3/samples/trunk/sample24/src/main/resources/help/SubTopic.html          
                (rev 0)
+++ core3/samples/trunk/sample24/src/main/resources/help/SubTopic.html  
2012-06-25 21:52:27 UTC (rev 29684)
@@ -0,0 +1,9 @@
+<html>
+  <head>
+    <title>Sample 24 Specific Help</title>
+  </head>
+  <body>
+    <h1>Sample 24 Specific Help</h1>
+    Plugin help is <em>totally</em> awesome...
+  </body>
+</html>

Added: core3/samples/trunk/sample24/src/main/resources/help/Topic.html
===================================================================
--- core3/samples/trunk/sample24/src/main/resources/help/Topic.html             
                (rev 0)
+++ core3/samples/trunk/sample24/src/main/resources/help/Topic.html     
2012-06-25 21:52:27 UTC (rev 29684)
@@ -0,0 +1,9 @@
+<html>
+  <head>
+    <title>Sample 24 Help</title>
+  </head>
+  <body>
+    <h1>Sample 24 Help</h1>
+    Balh blah blah...
+  </body>
+</html>

Added: core3/samples/trunk/sample24/src/main/resources/help/jhelpmap.jhm
===================================================================
--- core3/samples/trunk/sample24/src/main/resources/help/jhelpmap.jhm           
                (rev 0)
+++ core3/samples/trunk/sample24/src/main/resources/help/jhelpmap.jhm   
2012-06-25 21:52:27 UTC (rev 29684)
@@ -0,0 +1,9 @@
+<?xml version='1.0' encoding='ISO-8859-1' ?>
+<!DOCTYPE map
+  PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN"
+         "http://java.sun.com/products/javahelp/map_1_0.dtd";>
+
+<map version="1.0">
+  <mapID target="Topic" url="Topic.html" />
+  <mapID target="SubTopic" url="SubTopic.html" />
+</map>

Added: core3/samples/trunk/sample24/src/main/resources/help/jhelpset.hs
===================================================================
--- core3/samples/trunk/sample24/src/main/resources/help/jhelpset.hs            
                (rev 0)
+++ core3/samples/trunk/sample24/src/main/resources/help/jhelpset.hs    
2012-06-25 21:52:27 UTC (rev 29684)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<helpset version="2.0">
+   <title>PanGIA User Manual</title>
+   <maps>
+      <homeID>top</homeID>
+      <mapref location="jhelpmap.jhm"/>
+   </maps>
+   <view>
+      <name>TOC</name>
+      <label>Table Of Contents</label>
+      <type>javax.help.TOCView</type>
+      <data>jhelptoc.xml</data>
+   </view>
+</helpset>

Added: core3/samples/trunk/sample24/src/main/resources/help/jhelptoc.xml
===================================================================
--- core3/samples/trunk/sample24/src/main/resources/help/jhelptoc.xml           
                (rev 0)
+++ core3/samples/trunk/sample24/src/main/resources/help/jhelptoc.xml   
2012-06-25 21:52:27 UTC (rev 29684)
@@ -0,0 +1,10 @@
+<?xml version='1.0' encoding='ISO-8859-1' ?>
+
+<!DOCTYPE toc
+  PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 2.0//EN"
+         "http://java.sun.com/products/javahelp/toc_2_0.dtd";>
+<toc version="2.0">
+  <tocitem text="Sample 24 help" target="Topic">
+    <tocitem text="Sub-topic for sample 24." target="SubTopic"/>
+  </tocitem>
+</toc>

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to