Error in compiling Spark Plugin

I am trying to complie second example in Spark Development Guide. To add Workspace Tab.

ExamplePlugin.java

package org.jivesoftware.spark.examples;
package org.jivesoftware.spark.Workspace;

import org.jivesoftware.spark.plugin.Plugin;

/**

  • Implements the Spark Plugin framework to display the different possibilities using
  • Spark.
    /
    public class ExamplePlugin implements Plugin {
    /
    ** Adds a tab to Spark*/

private void addTabToSpark(){

// Get Workspace UI from SparkManager
Workspace workspace = SparkManager.getWorkspace();
// Retrieve the Tabbed Pane from the WorkspaceUI.
JTabbedPane tabbedPane = workspace.getWorkspacePane();
// Add own Tab.
tabbedPane.addTab(“My Plugin”, new JButton(“Hello”));
}
}

End OF File

When I complie with javac it errors me

javac ExamplePlugin.java
ExamplePlugin.java:2: class, interface, or enum expected
package org.jivesoftware.spark.Workspace;
^
1 error

Does any one have idea whats wrong with my code? Thanks for helping.

1, if you implements Plugin, you should implements it’s methods: initialize,uninstall,canShutDown,shutdown

2,SparkManager.getWorkspace().getWorkspacePene().addTab(title, icon, component [, tip] ), your function calling is not right.

I’ve changed the code as follows. Still the error is same.

ExamplePlugin.Java

package org.jivesoftware.spark.examples;
package org.jivesoftware.spark.Workspace;

import org.jivesoftware.spark.plugin.Plugin;

/**

  • Implements the Spark Plugin framework to display the different possibilities using
  • Spark.
    */

public class ExamplePlugin implements Plugin {

/** Called after Spark is loaded to initialize the new plugin. */

public void initialize() {
System.out.println(“Welcome To Spark”);

}

/**
 * Adds a tab to Spark
 */

private void addTabToSpark() {
 
  Workspace workspace = SparkManager.getWorkspace();
  JButton button = new JButton("HELLO SPARK USERS");
  workspace.getWorkspacePane().addTab("MyPlugin", button);
}

/**
* Called when Spark is shutting down to allow for persistence of information
* or releasing of resources. */

public void shutdown() {

}

/**
* Return true if the Spark can shutdown on users request.
* @return true if Spark can shutdown on users request. */

public boolean canShutDown() {

return true;
}

/**
* Is called when a user explicitly asked to uninstall this plugin.
* The plugin owner is responsible to clean up any resources and
* remove any components install in Spark. */

public void uninstall(){
// Remove all resources belonging to this plugin.
}
}

1, package org.jivesoftware.spark.examples;
package org.jivesoftware.spark.Workspace;

you can only have one package statement.

2, WorkspacePane.addTab(“MyPlugin”, button) not right. see addTab(title, icon, component [, tip] ). you can use eclipse to manager your project.