Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

de.hunsicker.jalopy.plugin
Class AbstractPlugin  view AbstractPlugin download AbstractPlugin.java

java.lang.Object
  extended byde.hunsicker.jalopy.plugin.AbstractPlugin

public abstract class AbstractPlugin
extends java.lang.Object

Skeleton implementation of a Jalopy Plug-in for integrated development environments.

Version:
$Revision: 1.8 $

Nested Class Summary
static class AbstractPlugin.Action
          Represents an action that can be performed.
private  class AbstractPlugin.ActionWorker
          Worker to perform our actions in a dedicated thread.
private static class AbstractPlugin.DefaultAppender
          Default appender to use if no custom appender was specified.
private static class AbstractPlugin.DummyStatusBar
           
private  class AbstractPlugin.FormatThread
          Helper to format several files in a dedicated thread.
private  class AbstractPlugin.GlassPane
          GlassPane used to block input whilst formatting the currently active file.
private  class AbstractPlugin.ProgressMonitorImpl
          A concrete progress monitor implemenation for Swing-based applications.
 
Field Summary
private  java.lang.Object[] _args
           
private  AbstractPlugin.GlassPane _glassPane
          Pane to display on top of all other components.
private  AbstractPlugin.Action _lastAction
          The action that was last performed.
private  java.lang.Object _lock
          Used as a monitor to synchronize processes.
private  java.awt.Component _oldGlassPane
          Stores the original glass pane.
private  de.hunsicker.jalopy.swing.ProgressMonitor _progressMonitor
          Progress monitor for long running operations.
private  long _start
          When did the worker thread start?
private  int _threadCount
          Number of running formatting threads.
private  AbstractPlugin.ActionWorker _worker
          Holds the currently running action worker.
protected  SwingAppender appender
          Appender to write messages to.
private static java.lang.String BUNDLE_NAME
          The name for ResourceBundle lookup.
private static StatusBar DEFAULT_STATUS_BAR
          The default status bar does nothing.
private static java.lang.String EMPTY_STRING
           
protected  de.hunsicker.jalopy.Jalopy jalopy
          The main Jalopy instance.
(package private)  int offset
           
private static java.awt.Cursor WAIT_CURSOR
          Cursor to display whilst long-running operations.
 
Constructor Summary
AbstractPlugin()
          Creates a new AbstractPlugin object.
AbstractPlugin(SwingAppender appender)
          Creates a new AbstractPlugin object.
 
Method Summary
 void afterEnd()
          Called on the event dispatching thread after an action was performed.
 void beforeStart()
          Called on the event dispatching thread before an action will be started.
private  void configureJalopy(de.hunsicker.jalopy.Jalopy jalopy)
          Configures the given Jalopy instance to meet the current code convention.
protected  de.hunsicker.jalopy.swing.ProgressMonitor createProgressMonitor()
          Creates a monitor to be used for long-running operations.
protected  void displayError(java.lang.Throwable error, java.awt.Frame parent)
          Displays an error dialog.
protected  void executeAsynchron(java.lang.Runnable operation)
          Executes the given runnable asynchronously on the AWT event dispatching thread.
protected  void executeSynchron(java.lang.Runnable operation)
          Executes the given runnable synchronously on the AWT event dispatching thread.
private  void format(ProjectFile file, de.hunsicker.jalopy.Jalopy jalopy)
          Formats the given file.
private  void formatSeveral(de.hunsicker.jalopy.Jalopy jalopy, java.util.Collection files)
          Formats the given files.
private  void formatSeveral(de.hunsicker.jalopy.Jalopy jalopy, java.util.Collection files, boolean checkThreading)
          Formats the given files.
abstract  Project getActiveProject()
          Returns the currently active project.
 long getElapsed()
          Returns the elapsed execution time of the run.
protected  de.hunsicker.jalopy.Jalopy getEngine()
          Returns a Jalopy instance.
protected abstract  de.hunsicker.io.FileFormat getFileFormat()
          Returns the file format to use for writing Java source files.
 AbstractPlugin.Action getLastAction()
          Returns the action that was performed last.
abstract  java.awt.Frame getMainWindow()
          Returns the main window of the application.
 de.hunsicker.jalopy.Jalopy.State getState()
          Returns the state info of Plug-in.
 StatusBar getStatusBar()
          Returns the active status bar.
private  void hideProgressMonitor()
           
protected  void hideWaitCursor()
          Hides the wait cursor.
private  void initLogging()
          Initializes the logging system.
 void interrupt()
          Interrupts the currently performed action, if any.
 boolean isRunning()
          Determines whether the Plug-in currently processes a request.
 void performAction(AbstractPlugin.Action action)
          Performs the given action.
protected  void showWaitCursor()
          Shows the wait cursor to indicate a long-running operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_STRING

private static final java.lang.String EMPTY_STRING

DEFAULT_STATUS_BAR

private static final StatusBar DEFAULT_STATUS_BAR
The default status bar does nothing.


WAIT_CURSOR

private static final java.awt.Cursor WAIT_CURSOR
Cursor to display whilst long-running operations.


BUNDLE_NAME

private static final java.lang.String BUNDLE_NAME
The name for ResourceBundle lookup.

See Also:
Constant Field Values

jalopy

protected de.hunsicker.jalopy.Jalopy jalopy
The main Jalopy instance.


appender

protected SwingAppender appender
Appender to write messages to.


offset

int offset

_lastAction

private AbstractPlugin.Action _lastAction
The action that was last performed.


_worker

private AbstractPlugin.ActionWorker _worker
Holds the currently running action worker.


_oldGlassPane

private java.awt.Component _oldGlassPane
Stores the original glass pane.


_glassPane

private AbstractPlugin.GlassPane _glassPane
Pane to display on top of all other components.


_lock

private final java.lang.Object _lock
Used as a monitor to synchronize processes.


_progressMonitor

private de.hunsicker.jalopy.swing.ProgressMonitor _progressMonitor
Progress monitor for long running operations.


_args

private final java.lang.Object[] _args

_threadCount

private int _threadCount
Number of running formatting threads.


_start

private long _start
When did the worker thread start?

Constructor Detail

AbstractPlugin

public AbstractPlugin()
Creates a new AbstractPlugin object. Uses a default appender which outputs all messages to System.out.


AbstractPlugin

public AbstractPlugin(SwingAppender appender)
Creates a new AbstractPlugin object.

Method Detail

getActiveProject

public abstract Project getActiveProject()
Returns the currently active project.


getMainWindow

public abstract java.awt.Frame getMainWindow()
Returns the main window of the application.


getElapsed

public long getElapsed()
Returns the elapsed execution time of the run.


getLastAction

public final AbstractPlugin.Action getLastAction()
Returns the action that was performed last.


getState

public final de.hunsicker.jalopy.Jalopy.State getState()
Returns the state info of Plug-in. Use this method to query the state after a run finished.


isRunning

public boolean isRunning()
Determines whether the Plug-in currently processes a request.

Since:
1.0b8

getStatusBar

public StatusBar getStatusBar()
Returns the active status bar. Override to provide access to the status bar of the used application.


afterEnd

public void afterEnd()
Called on the event dispatching thread after an action was performed.

Override this method to perform any custom work after the formatting process finished.


beforeStart

public void beforeStart()
Called on the event dispatching thread before an action will be started.

Override this method to perform any custom work before the formatting process starts.


interrupt

public final void interrupt()
Interrupts the currently performed action, if any.

Since:
1.0b8

performAction

public final void performAction(AbstractPlugin.Action action)
Performs the given action.


getFileFormat

protected abstract de.hunsicker.io.FileFormat getFileFormat()
Returns the file format to use for writing Java source files.


getEngine

protected de.hunsicker.jalopy.Jalopy getEngine()
Returns a Jalopy instance. The instance will be configured according to the current code convention.

Since:
1.0b8

createProgressMonitor

protected de.hunsicker.jalopy.swing.ProgressMonitor createProgressMonitor()
Creates a monitor to be used for long-running operations.


displayError

protected void displayError(java.lang.Throwable error,
                            java.awt.Frame parent)
Displays an error dialog.


executeAsynchron

protected void executeAsynchron(java.lang.Runnable operation)
Executes the given runnable asynchronously on the AWT event dispatching thread.


executeSynchron

protected void executeSynchron(java.lang.Runnable operation)
                        throws java.lang.InterruptedException,
                               java.lang.reflect.InvocationTargetException
Executes the given runnable synchronously on the AWT event dispatching thread.


hideWaitCursor

protected void hideWaitCursor()
Hides the wait cursor.


showWaitCursor

protected void showWaitCursor()
Shows the wait cursor to indicate a long-running operation. Keyboard and mouse input will be blocked.


configureJalopy

private void configureJalopy(de.hunsicker.jalopy.Jalopy jalopy)
Configures the given Jalopy instance to meet the current code convention.


format

private void format(ProjectFile file,
                    de.hunsicker.jalopy.Jalopy jalopy)
             throws java.io.IOException,
                    java.lang.reflect.InvocationTargetException
Formats the given file. This method performs the actual work.


formatSeveral

private void formatSeveral(de.hunsicker.jalopy.Jalopy jalopy,
                           java.util.Collection files)
                    throws java.io.IOException,
                           java.lang.reflect.InvocationTargetException
Formats the given files.


formatSeveral

private void formatSeveral(de.hunsicker.jalopy.Jalopy jalopy,
                           java.util.Collection files,
                           boolean checkThreading)
                    throws java.io.IOException,
                           java.lang.reflect.InvocationTargetException
Formats the given files.


hideProgressMonitor

private void hideProgressMonitor()

initLogging

private void initLogging()
Initializes the logging system. This method is called upon the creation of the object.