plugins.wlx
Class SWTWLXPlugin

java.lang.Object
  extended by plugins.wlx.WLXPluginAdapter
      extended by plugins.wlx.SWTWLXPlugin
All Implemented Interfaces:
WLXPluginInterface

public abstract class SWTWLXPlugin
extends WLXPluginAdapter

Author:
Ken

Field Summary
protected  org.eclipse.swt.widgets.Display display
          SWT display.
protected static int PROC_PARAM_CNT
          Parameter count of procedure windowProc.
 
Fields inherited from interface plugins.wlx.WLXPluginInterface
LC_COPY, LC_NEWPARAMS, LC_SELECT_ALL, LC_SETPERCENT, LCP_ANSI, LCP_ASCII, LCP_CENTER, LCP_FITLARGERONLY, LCP_FITTOWINDOW, LCP_FORCESHOW, LCP_VARIABLE, LCP_WRAPTEXT, LCS_BACKWARDS, LCS_FINDFIRST, LCS_MATCHCASE, LCS_WHOLEWORDS, LISTPLUGIN_ERROR, LISTPLUGIN_OK
 
Constructor Summary
SWTWLXPlugin()
           
 
Method Summary
abstract  org.eclipse.swt.widgets.Shell createShell()
          Create a new Shell.
abstract  void listCloseWindow()
          ListCloseWindow is called when a user closes lister, or loads a different file.
 void listCloseWindow(int listWin)
          ListCloseWindow is called when a user closes lister, or loads a different file.
 int listLoad(int parentWin, java.lang.String input, int showFlags)
          ListLoad is called when a user opens lister with F3 or the Quick View Panel with Ctrl+Q, and when the definition string either doesn't exist, or its evaluation returns true.
abstract  void listLoad(org.eclipse.swt.widgets.Shell shell, java.lang.String input, int showFlags)
          ListLoad is called when a user opens lister with F3 or the Quick View Panel with Ctrl+Q, and when the definition string either doesn't exist, or its evaluation returns true.
 
Methods inherited from class plugins.wlx.WLXPluginAdapter
getHWND, getHWND2, listDefaultGetParams, listGetDetectString, listGetPreviewBitmap, listLoadNext, listNotificationReceived, listPrint, listSearchDialog, listSearchText, listSendCommand, setSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROC_PARAM_CNT

protected static final int PROC_PARAM_CNT
Parameter count of procedure windowProc.

See Also:
Constant Field Values

display

protected org.eclipse.swt.widgets.Display display
SWT display.

Constructor Detail

SWTWLXPlugin

public SWTWLXPlugin()
Method Detail

listLoad

public final int listLoad(int parentWin,
                          java.lang.String input,
                          int showFlags)
ListLoad is called when a user opens lister with F3 or the Quick View Panel with Ctrl+Q, and when the definition string either doesn't exist, or its evaluation returns true.
Please note that multiple Lister windows can be open at the same time! Therefore you cannot save settings in global variables. You can call RegisterClass with the parameter cbWndExtra to reserve extra space for your data, which you can then access via GetWindowLong(). Or use an internal list, and store the list parameter via SetWindowLong(hwnd,GWL_ID,...). Lister will subclass your window to catch some hotkeys like 'n' or 'p'.
When lister is activated, it will set the focus to your window. If your window contains child windows, then make sure that you set the focus to the correct child when your main window receives the focus!
If lcp_forceshow is defined, you may try to load the file even if the plugin wasn't made for it. Example: A plugin with line numbers may only show the file as such when the user explicitly chooses 'Image/Multimedia' from the menu. Lister plugins which only create thumbnail images do not need to implement this function.

Specified by:
listLoad in interface WLXPluginInterface
Specified by:
listLoad in class WLXPluginAdapter
Parameters:
parentWin - This is lister's window. Create your plugin window as a child of this window.
input - The name of the file which has to be loaded.
showFlags - A combination of the following flags:
  • lcp_wraptext Text: Word wrap mode is checked
  • lcp_fittowindow Images: Fit image to window is checked
  • lcp_ansi Ansi charset is checked
  • lcp_ascii Ascii(DOS) charset is checked
  • lcp_variable Variable width charset is checked
  • lcp_forceshow User chose 'Image/Multimedia' from the menu. See remarks.
You may ignore these parameters if they don't apply to your document type.
Returns:
Return a handle to your window if load succeeds, NULL otherwise. If NULL is returned, Lister will try the next plugin.

listCloseWindow

public final void listCloseWindow(int listWin)
ListCloseWindow is called when a user closes lister, or loads a different file. If ListCloseWindow isn't present, DestroyWindow() is called.
You can use this function to close open files, free buffers etc.

Specified by:
listCloseWindow in interface WLXPluginInterface
Overrides:
listCloseWindow in class WLXPluginAdapter
Parameters:
listWin - This is the window handle which needs to be destroyed.

createShell

public abstract org.eclipse.swt.widgets.Shell createShell()
Create a new Shell. This method is called first. Do not create contents here, listLoad is the right place to create contents.

e.g. return new Shell(display);

Returns:
the Shell instance of the lister window contents.

listLoad

public abstract void listLoad(org.eclipse.swt.widgets.Shell shell,
                              java.lang.String input,
                              int showFlags)
ListLoad is called when a user opens lister with F3 or the Quick View Panel with Ctrl+Q, and when the definition string either doesn't exist, or its evaluation returns true.
Please note that multiple Lister windows can be open at the same time! Therefore you cannot save settings in global variables. You can call RegisterClass with the parameter cbWndExtra to reserve extra space for your data, which you can then access via GetWindowLong(). Or use an internal list, and store the list parameter via SetWindowLong(hwnd,GWL_ID,...). Lister will subclass your window to catch some hotkeys like 'n' or 'p'.
When lister is activated, it will set the focus to your window. If your window contains child windows, then make sure that you set the focus to the correct child when your main window receives the focus!
If lcp_forceshow is defined, you may try to load the file even if the plugin wasn't made for it. Example: A plugin with line numbers may only show the file as such when the user explicitly chooses 'Image/Multimedia' from the menu. Lister plugins which only create thumbnail images do not need to implement this function.

Parameters:
shell - SWT shell
input - The name of the file which has to be loaded.
showFlags - A combination of the following flags:
  • lcp_wraptext Text: Word wrap mode is checked
  • lcp_fittowindow Images: Fit image to window is checked
  • lcp_ansi Ansi charset is checked
  • lcp_ascii Ascii(DOS) charset is checked
  • lcp_variable Variable width charset is checked
  • lcp_forceshow User chose 'Image/Multimedia' from the menu. See remarks.
You may ignore these parameters if they don't apply to your document type.
See Also:
WLXPluginInterface.listLoad(int, String, int)

listCloseWindow

public abstract void listCloseWindow()
ListCloseWindow is called when a user closes lister, or loads a different file. If ListCloseWindow isn't present, DestroyWindow() is called.
You can use this function to close open files, free buffers etc.

See Also:
WLXPluginInterface.listCloseWindow(int)