|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.commands.common.EventManager
org.eclipse.ui.part.WorkbenchPart
org.eclipse.ui.part.ViewPart
com.ibm.productivity.tools.ui.views.DefaultRichDocumentView
This is the default Eclipse ViewPart to manipulate a rich document. It implements
the RichDocumentView
interface to enhance the view by providing
document operation APIs.
public class WriterView extends DefaultRichDocumentView {
public WriterView() {
super();
}
public void createPartControl(Composite parent) {
super.createPartControl(parent);
createWriter();
}
private void createWriter()
{
NewOperation operation = OperationFactory.createNewOperation(RichDocumentType.DOCUMENT_TYPE );
this.executeOperation( operation );
}
}
RichDocumentView
Field Summary | |
---|---|
static java.lang.String |
VIEW_ID
The ID for this ViewPart. |
Fields inherited from interface org.eclipse.ui.ISaveablePart2 |
---|
CANCEL, DEFAULT, NO, YES |
Fields inherited from interface org.eclipse.ui.ISaveablePart |
---|
PROP_DIRTY |
Fields inherited from interface org.eclipse.ui.IWorkbenchPart |
---|
PROP_TITLE |
Constructor Summary | |
---|---|
DefaultRichDocumentView()
|
Method Summary | |
---|---|
void |
addOperationListener(OperationListener listener)
Adds an OperationListener into the view. |
void |
createPartControl(org.eclipse.swt.widgets.Composite arg0)
|
void |
dispose()
|
void |
doSave(org.eclipse.core.runtime.IProgressMonitor arg0)
|
void |
doSaveAs()
|
void |
executeOperation(Operation operation)
Starts the operation in the view. |
java.lang.Object |
getAdapter(java.lang.Class clz)
|
RichDocumentType |
getDocumentType()
Gets the type of the current document. |
java.lang.String |
getFilePath()
Gets the absolute path of the document loaded in the view. |
java.lang.Object |
getUNOModel()
Returns the com.sun.star.frame.XModel object when the operation is started. |
boolean |
isDirty()
|
boolean |
isSaveAsAllowed()
|
boolean |
isSaveOnCloseNeeded()
|
int |
promptToSaveOnClose()
|
void |
removeOperationListener(OperationListener listener)
Removes a registered OperationListener from the view. |
void |
setFocus()
|
Methods inherited from class org.eclipse.ui.part.ViewPart |
---|
getViewSite, init, init, saveState, setInitializationData |
Methods inherited from class org.eclipse.ui.part.WorkbenchPart |
---|
addPropertyListener, getContentDescription, getOrientation, getPartName, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener, showBusy |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.ui.IWorkbenchPart |
---|
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener |
Field Detail |
public static final java.lang.String VIEW_ID
Constructor Detail |
public DefaultRichDocumentView()
Method Detail |
public void setFocus()
setFocus
in interface org.eclipse.ui.IWorkbenchPart
public java.lang.Object getAdapter(java.lang.Class clz)
getAdapter
in interface org.eclipse.core.runtime.IAdaptable
public void createPartControl(org.eclipse.swt.widgets.Composite arg0)
createPartControl
in interface org.eclipse.ui.IWorkbenchPart
public void dispose()
dispose
in interface org.eclipse.ui.IWorkbenchPart
public void addOperationListener(OperationListener listener)
RichDocumentView
OperationListener
into the view. If an operation is invoked,
the listener is notified.
addOperationListener
in interface RichDocumentView
listener
- a listener to be notified when an operation is startedOperationListener
public void removeOperationListener(OperationListener listener)
RichDocumentView
OperationListener
from the view.
removeOperationListener
in interface RichDocumentView
listener
- the listener to be removedOperationListener
public void executeOperation(Operation operation) throws java.lang.UnsupportedOperationException
RichDocumentView
executeOperation
in interface RichDocumentView
operation
- the operation to be started
java.lang.UnsupportedOperationException
- if an error occurs while running the operation.Operation
public java.lang.Object getUNOModel()
RichDocumentView
The following code demonstrates how to use the UNO model:
private void createTable( ) throws Exception {
NewOperation operation = ...;
Object obj = operation.getUNOModel();
com.sun.star.lang.XMultiServiceFactory factory = (com.sun.star.lang.XMultiServiceFactory)
UnoRuntime.queryInterface(com.sun.star.lang.XMultiServiceFactory.class, obj);
com.sun.star.text.XTextDocument textDoc = (com.sun.star.text.XTextDocument)
UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, obj);
obj = factory.createInstance("com.sun.star.text.TextTable");
com.sun.star.text.XTextTable table = (com.sun.star.text.XTextTable)
UnoRuntime.queryInterface(XTextTable.class, obj);
table.initialize(10, 10);
textDoc.getText().insertTextContent(textDoc.getText().getStart(),
table, false);
}
getUNOModel
in interface RichDocumentView
public int promptToSaveOnClose()
promptToSaveOnClose
in interface org.eclipse.ui.ISaveablePart2
public void doSave(org.eclipse.core.runtime.IProgressMonitor arg0)
doSave
in interface org.eclipse.ui.ISaveablePart
public void doSaveAs()
doSaveAs
in interface org.eclipse.ui.ISaveablePart
public boolean isDirty()
isDirty
in interface org.eclipse.ui.ISaveablePart
public boolean isSaveAsAllowed()
isSaveAsAllowed
in interface org.eclipse.ui.ISaveablePart
public boolean isSaveOnCloseNeeded()
isSaveOnCloseNeeded
in interface org.eclipse.ui.ISaveablePart
public RichDocumentType getDocumentType()
RichDocumentView
getDocumentType
in interface RichDocumentView
RichDocumentType
public java.lang.String getFilePath()
RichDocumentView
c:\\test.odt
on Windows® operating systems, and /home/test.odt
on
Linux® operating systems.
getFilePath
in interface RichDocumentView
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |