public class DefaultFileHandler extends java.lang.Object implements FileHandler
FileTypeUnit
class are used to open/edit
files. For application functionality e.g. opening a file in a form editor can be achieved
by subclassing this class.
Opening/editing a file for an application means to start an appropriate (text) editor.
Modifier and Type | Field and Description |
---|---|
protected int[] |
edittypes
The priority types list for edit.
|
protected EditorWindow |
editwindow
The docking window to add new editor tabs.
|
protected FileTypeUnit |
fileTypeUnit
The options unit providing the configured files types for open/edit.
|
protected int[] |
hexedittypes
The priority types list for hex edit.
|
protected ApplicationModel |
model
The model holding the configuration.
|
protected int[] |
opentypes
The priority types list for open.
|
protected java.lang.String |
unitID
The unique ID for the
FileTypeUnit . |
Constructor and Description |
---|
DefaultFileHandler()
Constructor method for i18n purposes only.
|
DefaultFileHandler(ApplicationModel model,
java.lang.String unitid,
FileTypeUnit unit,
EditorWindow editwindow,
int[] opentypes,
int[] edittypes,
int[] hexedittypes)
Constructor for the component.
|
Modifier and Type | Method and Description |
---|---|
boolean |
chooseFileOpenEdit(int appmask,
java.awt.Component parent,
StatusBar statusbar)
Let's the user choose files to open/edit on basis of the configured file types.
|
boolean |
chooseURLOpenEdit(int appmask,
java.awt.Component parent,
StatusBar statusbar)
Let's the user choose network files to open/edit on basis of the configured file types.
|
java.io.File[] |
edit(java.io.File[] files)
Called if the user start editing a file.
|
org.apache.commons.vfs2.FileObject[] |
edit(org.apache.commons.vfs2.FileObject[] urls)
Called if the user start editing a network file.
|
javax.swing.JMenuItem[] |
handle(java.io.File[] files)
Called when a context menu (popup) becomes visible.
|
javax.swing.JMenuItem[] |
handle(org.apache.commons.vfs2.FileObject[] urls)
Called when a context menu (popup) becomes visible.
|
java.io.File[] |
hexedit(java.io.File[] files)
Called if the user start hex editing a file.
|
org.apache.commons.vfs2.FileObject[] |
hexedit(org.apache.commons.vfs2.FileObject[] urls)
Called if the user start hexediting a network file.
|
java.io.File[] |
open(java.io.File[] files)
Called if the user double-clicks a file.
|
org.apache.commons.vfs2.FileObject[] |
open(org.apache.commons.vfs2.FileObject[] urls)
Called if the user double-clicks a network file.
|
protected ApplicationModel model
protected java.lang.String unitID
FileTypeUnit
.protected FileTypeUnit fileTypeUnit
protected EditorWindow editwindow
protected int[] opentypes
protected int[] edittypes
protected int[] hexedittypes
public DefaultFileHandler() throws java.lang.InstantiationException
I18NExtractor
).
java.lang.InstantiationException
- Error indicationpublic DefaultFileHandler(ApplicationModel model, java.lang.String unitid, FileTypeUnit unit, EditorWindow editwindow, int[] opentypes, int[] edittypes, int[] hexedittypes)
model
- The model holding the configuration (required)unitid
- The unique ID for the FileTypeUnit
(required)unit
- The options unit (required)editwindow
- The docking window to add new editor tabs (required)opentypes
- The priority types list for open (optional)edittypes
- The priority types list for edit (optional)hexedittypes
- The priority types list for hex edit (optional)java.lang.IllegalArgumentException
- If a parameter is invalidpublic javax.swing.JMenuItem[] handle(java.io.File[] files)
null
so that context menues do not become visible at
all in certain conditions.
handle
in interface FileHandler
files
- The files to be checkednull
or emptypublic java.io.File[] open(java.io.File[] files)
true
to indicate that it has been opened. If it returns false
then the other handlers can be informed in the same way (first come first serve).
open
in interface FileHandler
files
- The files to be openedpublic java.io.File[] edit(java.io.File[] files)
true
to indicate that it has been opened. If it returns false
then the other handlers can be informed in the same way (first come first serve).
edit
in interface FileHandler
files
- The files to be editedpublic java.io.File[] hexedit(java.io.File[] files)
true
to indicate that it has been opened. If it returns false
then the other handlers can be informed in the same way (first come first serve).
hexedit
in interface FileHandler
files
- The files to be hexeditedpublic boolean chooseFileOpenEdit(int appmask, java.awt.Component parent, StatusBar statusbar)
appmask
- Binary mask of FileTypeDef.APP_OPEN
, ...parent
- The parental component (e.g. main window)statusbar
- Status bar for messages (optional)true
if the file was opened successfullypublic javax.swing.JMenuItem[] handle(org.apache.commons.vfs2.FileObject[] urls)
null
so that context menues do not become visible at
all in certain conditions.
handle
in interface FileHandler
urls
- The network files to be checkednull
or emptypublic org.apache.commons.vfs2.FileObject[] open(org.apache.commons.vfs2.FileObject[] urls)
true
to indicate that it has been opened. If it returns false
then the other handlers can be informed in the same way (first come first serve).
open
in interface FileHandler
urls
- The network files to be openedpublic org.apache.commons.vfs2.FileObject[] edit(org.apache.commons.vfs2.FileObject[] urls)
true
to indicate that it has been opened. If it returns false
then the other handlers can be informed in the same way (first come first serve).
edit
in interface FileHandler
urls
- The network files to be editedpublic org.apache.commons.vfs2.FileObject[] hexedit(org.apache.commons.vfs2.FileObject[] urls)
true
to indicate that it has been opened. If it returns false
then the other handlers can be informed in the same way (first come first serve).
hexedit
in interface FileHandler
urls
- The network files to be hexeditedpublic boolean chooseURLOpenEdit(int appmask, java.awt.Component parent, StatusBar statusbar)
appmask
- Binary mask of FileTypeDef.APP_OPEN
, ...parent
- The parental component (e.g. main window)statusbar
- Status bar for messages (optional)true
if the file was opened successfullyCopyright © 2005-2013 Leisenfels UG (haftungsbeschränkt). All rights reserved.