You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2016/11/13 16:13:18 UTC
svn commit: r1769512 [2/15] - in /uima/uimaj/branches/experiment-v3-jcas:
uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/
uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/
uimaj-ep-cas-editor/src/main/java/org/apache/uim...
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java Sun Nov 13 16:13:16 2016
@@ -143,14 +143,22 @@ import org.eclipse.ui.texteditor.IWorkbe
import org.eclipse.ui.texteditor.StatusTextEditor;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+// TODO: Auto-generated Javadoc
/**
* An editor to annotate text.
*/
public final class AnnotationEditor extends StatusTextEditor implements ICasEditor, ISelectionListener {
+ /**
+ * The Class AbstractAnnotateAction.
+ */
private abstract class AbstractAnnotateAction extends Action
implements ISelectionChangedListener {
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
setEnabled(AnnotationEditor.this.getSelection().y -
AnnotationEditor.this.getSelection().x > 0);
@@ -162,14 +170,16 @@ public final class AnnotationEditor exte
*/
private class QuickAnnotateAction extends AbstractAnnotateAction {
+ /** The Constant ID. */
private static final String ID = "QuickAnnotate";
+ /** The m text widget. */
private StyledText mTextWidget;
/**
* Initializes a new instance.
*
- * @param textWidget
+ * @param textWidget the text widget
*/
QuickAnnotateAction(StyledText textWidget) {
mTextWidget = textWidget;
@@ -204,15 +214,27 @@ public final class AnnotationEditor exte
}
}
+ /**
+ * Gets the document.
+ *
+ * @return the document
+ */
ICasDocument getDocument() {
return AnnotationEditor.this.getDocument();
}
}
+ /**
+ * The Class SmartAnnotateAction.
+ */
private class SmartAnnotateAction extends AbstractAnnotateAction {
+ /** The Constant ID. */
private static final String ID = "Annotate";
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
@Override
public void run() {
@@ -231,6 +253,8 @@ public final class AnnotationEditor exte
* Shows the annotation editing context for the active annotation.
*/
private class ShowAnnotationContextEditAction extends Action {
+
+ /** The m presenter. */
private InformationPresenter mPresenter;
/**
@@ -279,13 +303,15 @@ public final class AnnotationEditor exte
/**
* This <code>IDocumentChangeListener</code> is responsible to synchronize annotation in the
* document with the annotations in eclipse.
+ *
+ * @see DocumentEvent
*/
private class DocumentListener extends AbstractAnnotationDocumentListener {
/**
* Adds a collection of annotations.
*
- * @param annotations
+ * @param annotations the annotations
*/
@Override
public void addedAnnotation(Collection<AnnotationFS> annotations) {
@@ -304,7 +330,7 @@ public final class AnnotationEditor exte
/**
* Removes a collection of annotations.
*
- * @param deletedAnnotations
+ * @param deletedAnnotations the deleted annotations
*/
@Override
public void removedAnnotation(Collection<AnnotationFS> deletedAnnotations) {
@@ -329,8 +355,9 @@ public final class AnnotationEditor exte
}
/**
+ * Updated annotation.
*
- * @param annotations
+ * @param annotations the annotations
*/
@Override
public void updatedAnnotation(Collection<AnnotationFS> annotations) {
@@ -345,12 +372,20 @@ public final class AnnotationEditor exte
selectionChanged(getSite().getPage().getActivePart(), mFeatureStructureSelectionProvider.getSelection());
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.caseditor.editor.AbstractDocumentListener#changed()
+ */
+ @Override
public void changed() {
mFeatureStructureSelectionProvider.clearSelection();
syncAnnotations();
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.caseditor.editor.AbstractDocumentListener#viewChanged(java.lang.String, java.lang.String)
+ */
+ @Override
public void viewChanged(String oldViewName, String newViewName) {
// TODO: Currently do nothing ...
}
@@ -358,14 +393,25 @@ public final class AnnotationEditor exte
/**
* Sometimes the wrong annotation is selected ... ????
+ *
+ * @see FeatureStructureDragEvent
*/
private class FeatureStructureDragListener implements DragSourceListener {
+
+ /** The m is active. */
private boolean mIsActive;
+ /** The m candidate. */
private AnnotationFS mCandidate;
+ /**
+ * Instantiates a new feature structure drag listener.
+ *
+ * @param textWidget the text widget
+ */
FeatureStructureDragListener(final StyledText textWidget) {
textWidget.addKeyListener(new KeyListener() {
+ @Override
public void keyPressed(KeyEvent e) {
if (e.keyCode == SWT.ALT) {
mIsActive = true;
@@ -374,6 +420,7 @@ public final class AnnotationEditor exte
}
}
+ @Override
public void keyReleased(KeyEvent e) {
if (e.stateMask == SWT.ALT) {
mIsActive = false;
@@ -384,6 +431,7 @@ public final class AnnotationEditor exte
textWidget.addMouseMoveListener(new MouseMoveListener() {
+ @Override
public void mouseMove(MouseEvent e) {
if (mIsActive) {
// try to get the position inside the text
@@ -412,6 +460,10 @@ public final class AnnotationEditor exte
});
}
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.dnd.DragSourceListener#dragStart(org.eclipse.swt.dnd.DragSourceEvent)
+ */
+ @Override
public void dragStart(DragSourceEvent event) {
if (mIsActive) {
event.doit = mCandidate != null;
@@ -420,28 +472,55 @@ public final class AnnotationEditor exte
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.dnd.DragSourceListener#dragSetData(org.eclipse.swt.dnd.DragSourceEvent)
+ */
+ @Override
public void dragSetData(DragSourceEvent event) {
event.data = mCandidate;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.dnd.DragSourceListener#dragFinished(org.eclipse.swt.dnd.DragSourceEvent)
+ */
+ @Override
public void dragFinished(DragSourceEvent event) {
}
}
+ /**
+ * The Class AnnotationAccess.
+ */
private class AnnotationAccess implements IAnnotationAccess, IAnnotationAccessExtension {
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.source.IAnnotationAccess#getType(org.eclipse.jface.text.source.Annotation)
+ */
+ @Override
public Object getType(Annotation annotation) {
return null;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.source.IAnnotationAccess#isMultiLine(org.eclipse.jface.text.source.Annotation)
+ */
+ @Override
public boolean isMultiLine(Annotation annotation) {
return false;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.source.IAnnotationAccess#isTemporary(org.eclipse.jface.text.source.Annotation)
+ */
+ @Override
public boolean isTemporary(Annotation annotation) {
return false;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.source.IAnnotationAccessExtension#getLayer(org.eclipse.jface.text.source.Annotation)
+ */
+ @Override
public int getLayer(Annotation annotation) {
if (annotation instanceof EclipseAnnotationPeer) {
@@ -461,14 +540,26 @@ public final class AnnotationEditor exte
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.source.IAnnotationAccessExtension#getSupertypes(java.lang.Object)
+ */
+ @Override
public Object[] getSupertypes(Object annotationType) {
return new Object[0];
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.source.IAnnotationAccessExtension#getTypeLabel(org.eclipse.jface.text.source.Annotation)
+ */
+ @Override
public String getTypeLabel(Annotation annotation) {
return null;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.source.IAnnotationAccessExtension#isPaintable(org.eclipse.jface.text.source.Annotation)
+ */
+ @Override
public boolean isPaintable(Annotation annotation) {
assert false : "Should never be called";
@@ -478,7 +569,12 @@ public final class AnnotationEditor exte
/**
* This implementation imitates the behavior without the
* {@link IAnnotationAccessExtension}.
+ *
+ * @param annotationType the annotation type
+ * @param potentialSupertype the potential supertype
+ * @return true, if is subtype
*/
+ @Override
public boolean isSubtype(Object annotationType, Object potentialSupertype) {
Type type = getDocument().getCAS().getTypeSystem().getType((String) annotationType);
@@ -487,20 +583,36 @@ public final class AnnotationEditor exte
getAnnotationMode().equals(type);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.source.IAnnotationAccessExtension#paint(org.eclipse.jface.text.source.Annotation, org.eclipse.swt.graphics.GC, org.eclipse.swt.widgets.Canvas, org.eclipse.swt.graphics.Rectangle)
+ */
+ @Override
public void paint(Annotation annotation, GC gc, Canvas canvas, Rectangle bounds) {
assert false : "Should never be called";
}
}
+ /**
+ * The Class CasViewMenu.
+ */
// TODO: Move to external class
static class CasViewMenu extends ContributionItem {
+ /** The cas editor. */
private AnnotationEditor casEditor;
+ /**
+ * Instantiates a new cas view menu.
+ *
+ * @param casEditor the cas editor
+ */
public CasViewMenu(AnnotationEditor casEditor) {
this.casEditor = casEditor;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets.Menu, int)
+ */
@Override
public void fill(Menu parentMenu, int index) {
@@ -530,6 +642,7 @@ public final class AnnotationEditor exte
// TODO: move this to an action
actionItem.addListener(SWT.Selection, new Listener() {
+ @Override
public void handleEvent(Event e) {
// Trigger only if view is really changed
// TODO: Move this check to the document itself ...
@@ -542,6 +655,7 @@ public final class AnnotationEditor exte
}
}
+ /** The m annotation mode. */
private Type mAnnotationMode;
/**
@@ -549,33 +663,43 @@ public final class AnnotationEditor exte
*/
private OutlinePageBook mOutlinePage = new OutlinePageBook();
+ /** The m editor listener. */
private Set<IAnnotationEditorModifyListener> mEditorListener = new HashSet<IAnnotationEditorModifyListener>();
+ /** The m editor input listener. */
private ListenerList mEditorInputListener = new ListenerList();
- /**
- * TODO: Do we really need this position variable ?
- */
+ /** TODO: Do we really need this position variable ?. */
private int mCursorPosition;
+ /** The m is something highlighted. */
boolean mIsSomethingHighlighted = false;
+ /** The m current style range. */
private StyleRange mCurrentStyleRange;
+ /** The m feature structure selection provider. */
private FeatureStructureSelectionProvider mFeatureStructureSelectionProvider;
+ /** The m painter. */
private AnnotationPainter mPainter;
+ /** The m show annotations menu. */
private ShowAnnotationsMenu mShowAnnotationsMenu;
+ /** The m annotation synchronizer. */
private DocumentListener mAnnotationSynchronizer;
+ /** The m annotation style listener. */
private AnnotationStyleChangeListener mAnnotationStyleListener;
+ /** The shown annotation types. */
private Collection<Type> shownAnnotationTypes = new HashSet<Type>();
+ /** The preference store change listener. */
private IPropertyChangeListener preferenceStoreChangeListener;
+ /** The cas document provider. */
private CasDocumentProvider casDocumentProvider;
/**
@@ -584,6 +708,9 @@ public final class AnnotationEditor exte
public AnnotationEditor() {
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.AbstractTextEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
+ */
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
casDocumentProvider =
@@ -594,6 +721,10 @@ public final class AnnotationEditor exte
super.init(site, input);
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.caseditor.editor.ICasEditor#getCasDocumentProvider()
+ */
+ @Override
public CasDocumentProvider getCasDocumentProvider() {
return casDocumentProvider;
}
@@ -624,7 +755,7 @@ public final class AnnotationEditor exte
/**
* Retrieves annotation editor adapters.
*
- * @param adapter
+ * @param adapter the adapter
* @return an adapter or null
*/
@Override
@@ -642,6 +773,9 @@ public final class AnnotationEditor exte
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.AbstractTextEditor#createSourceViewer(org.eclipse.swt.widgets.Composite, org.eclipse.jface.text.source.IVerticalRuler, int)
+ */
@Override
protected ISourceViewer createSourceViewer(Composite parent,
org.eclipse.jface.text.source.IVerticalRuler ruler, int styles) {
@@ -656,6 +790,11 @@ public final class AnnotationEditor exte
return sourceViewer;
}
+ /**
+ * Sets the text size.
+ *
+ * @param newSize the new text size
+ */
private void setTextSize(int newSize) {
Font font = getSourceViewer().getTextWidget().getFont();
@@ -668,8 +807,8 @@ public final class AnnotationEditor exte
/**
* Configures the editor.
- *
- * @param parent
+ *
+ * @param parent the parent
*/
@Override
public void createPartControl(Composite parent) {
@@ -691,6 +830,7 @@ public final class AnnotationEditor exte
// that are key and mouse listeners.
getSourceViewer().getTextWidget().addKeyListener(new KeyListener() {
+ @Override
public void keyPressed(KeyEvent e) {
int newCaretOffset = getSourceViewer().getTextWidget().getCaretOffset();
@@ -700,6 +840,7 @@ public final class AnnotationEditor exte
}
}
+ @Override
public void keyReleased(KeyEvent e) {
// not implemented
}
@@ -707,6 +848,7 @@ public final class AnnotationEditor exte
});
getSourceViewer().getTextWidget().addMouseListener(new MouseListener() {
+ @Override
public void mouseDown(MouseEvent e) {
int newCaretOffset = getSourceViewer().getTextWidget().getCaretOffset();
@@ -716,10 +858,12 @@ public final class AnnotationEditor exte
}
}
+ @Override
public void mouseDoubleClick(MouseEvent e) {
// not needed
}
+ @Override
public void mouseUp(MouseEvent e) {
int newCaretOffset = getSourceViewer().getTextWidget().getCaretOffset();
@@ -741,6 +885,7 @@ public final class AnnotationEditor exte
// Changed again to ensure that also selection from the find dialog
// can be detected
getSourceViewer().getSelectionProvider().addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
mFeatureStructureSelectionProvider.setSelection(new AnnotationEditorSelection((ITextSelection) event.getSelection(),
new StructuredSelection(ModelFeatureStructure.create(getDocument(), getSelectedAnnotations()))));
@@ -771,6 +916,7 @@ public final class AnnotationEditor exte
preferenceStoreChangeListener = (new IPropertyChangeListener() {
+ @Override
public void propertyChange(PropertyChangeEvent event) {
if (AnnotationEditorPreferenceConstants.ANNOTATION_EDITOR_TEXT_SIZE.equals(event.getProperty())) {
Integer textSize = (Integer) event.getNewValue();
@@ -793,6 +939,9 @@ public final class AnnotationEditor exte
initiallySynchronizeUI();
}
+ /**
+ * Refresh selection.
+ */
private void refreshSelection() {
mFeatureStructureSelectionProvider.setSelection(getDocument(), getSelectedAnnotations());
}
@@ -810,7 +959,7 @@ public final class AnnotationEditor exte
/**
- * Used to inform about input changes
+ * Used to inform about input changes.
*/
@Override
protected void handleElementContentReplaced() {
@@ -818,6 +967,9 @@ public final class AnnotationEditor exte
setInput(getEditorInput());
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.StatusTextEditor#doSetInput(org.eclipse.ui.IEditorInput)
+ */
@Override
protected void doSetInput(final IEditorInput input) throws CoreException {
final IEditorInput oldInput = getEditorInput();
@@ -839,6 +991,7 @@ public final class AnnotationEditor exte
if (CasEditorPlugin.getDefault().
getAndClearShowMigrationDialogFlag()) {
getSite().getShell().getDisplay().asyncExec(new Runnable() {
+ @Override
public void run() {
MessageDialog.openInformation(getSite().getShell(),"Cas Editor Project Removed",
"The Cas Editor Project support was removed from this release and" +
@@ -919,6 +1072,7 @@ public final class AnnotationEditor exte
(ICasEditorInputListener) listener;
SafeRunner.run(new SafeRunnable() {
+ @Override
public void run() {
inputListener.casDocumentChanged(oldInput, oldDocument, input, newDocument);
}
@@ -929,6 +1083,9 @@ public final class AnnotationEditor exte
// The editor status support is abused to display different control than the
// text control when displaying text is not possible, e.g. because the sofa
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.StatusTextEditor#isErrorStatus(org.eclipse.core.runtime.IStatus)
+ */
// is not a text sofa or not set at all
@Override
protected boolean isErrorStatus(IStatus status) {
@@ -947,6 +1104,7 @@ public final class AnnotationEditor exte
getDocument().getCAS().getTypeSystem(), shownAnnotationTypes);
mShowAnnotationsMenu.addListener(new IShowAnnotationsListener() {
+ @Override
public void selectionChanged(Collection<Type> selection) {
// compute change sets and apply changes:
@@ -1011,6 +1169,9 @@ public final class AnnotationEditor exte
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.AbstractTextEditor#editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
+ */
@Override
protected void editorContextMenuAboutToShow(IMenuManager menu) {
super.editorContextMenuAboutToShow(menu);
@@ -1019,7 +1180,7 @@ public final class AnnotationEditor exte
menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getAction(SmartAnnotateAction.ID));
menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getAction(QuickAnnotateAction.ID));
- menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getAction(ITextEditorActionDefinitionIds.DELETE));
+ menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getAction(IWorkbenchActionDefinitionIds.DELETE));
TypeSystem typeSytem = getDocument().getCAS().getTypeSystem();
@@ -1030,6 +1191,7 @@ public final class AnnotationEditor exte
ModeMenu modeMenu = new ModeMenu(typeSytem, this);
modeMenu.addListener(new IModeMenuListener(){
+ @Override
public void modeChanged(Type newMode) {
IAction actionToExecute = new ChangeModeAction(newMode, newMode.getShortName(),
AnnotationEditor.this);
@@ -1069,10 +1231,15 @@ public final class AnnotationEditor exte
*
* @return current <code>AnnotationDocument</code>
*/
+ @Override
public ICasDocument getDocument() {
return (ICasDocument) getDocumentProvider().getDocument(getEditorInput());
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.caseditor.editor.ICasEditor#reopenEditorWithNewTypeSystem()
+ */
+ @Override
public void reopenEditorWithNewTypeSystem() {
setInput(getEditorInput());
}
@@ -1089,7 +1256,7 @@ public final class AnnotationEditor exte
/**
* Sets the new annotation type.
*
- * @param type
+ * @param type the new annotation mode
*/
public void setAnnotationMode(Type type) {
// TODO: check if this type is a subtype of Annotation
@@ -1113,20 +1280,38 @@ public final class AnnotationEditor exte
mShowAnnotationsMenu.setEditorAnnotationMode(type);
}
+ /**
+ * Gets the shown annotation types.
+ *
+ * @return the shown annotation types
+ */
public Collection<Type> getShownAnnotationTypes() {
return Collections.unmodifiableCollection(shownAnnotationTypes);
}
+ /**
+ * Sets the shown annotation type.
+ *
+ * @param type the type
+ * @param isShown the is shown
+ */
public void setShownAnnotationType(Type type, boolean isShown) {
mShowAnnotationsMenu.setSelectedType(type, isShown);
}
+ /**
+ * Sets the shown annotation types.
+ *
+ * @param types the new shown annotation types
+ */
public void setShownAnnotationTypes(Collection<Type> types) {
mShowAnnotationsMenu.setSelectedTypes(types);
}
/**
- * @param type
+ * Fire annotation type changed.
+ *
+ * @param type the type
*/
private void fireAnnotationTypeChanged(Type type) {
if (mEditorListener != null) {
@@ -1138,7 +1323,8 @@ public final class AnnotationEditor exte
/**
* Retrieves an <code>AnnotationStyle</code> from the underlying storage.
*
- * @param type
+ * @param type the type
+ * @return the annotation style
*/
public AnnotationStyle getAnnotationStyle(Type type) {
if (type == null)
@@ -1155,8 +1341,8 @@ public final class AnnotationEditor exte
* Sets an annotation style.
*
* Note: Internal usage only!
- *
- * @param style
+ *
+ * @param style the new annotation style
*/
// TODO: Disk must be accessed for every changed annotation style
// add a second method which can take all changed styles
@@ -1169,8 +1355,8 @@ public final class AnnotationEditor exte
/**
* Set the shown annotation status of a type.
- *
- * @param type
+ *
+ * @param type the type
* @param isVisible if true the type is shown, if false the type
* it not shown
*/
@@ -1241,12 +1427,18 @@ public final class AnnotationEditor exte
mPainter.paint(IPainter.CONFIGURATION);
}
+ /**
+ * Removes the all annotations.
+ */
private void removeAllAnnotations() {
// Remove all annotation from the model
IAnnotationModel annotationModel = getDocumentProvider().getAnnotationModel(getEditorInput());
((IAnnotationModelExtension) annotationModel).removeAllAnnotations();
}
+ /**
+ * Sync annotations.
+ */
private void syncAnnotations() {
removeAllAnnotations();
@@ -1273,20 +1465,35 @@ public final class AnnotationEditor exte
}
/**
- * @param listener
+ * Adds the annotation listener.
+ *
+ * @param listener the listener
*/
public void addAnnotationListener(IAnnotationEditorModifyListener listener) {
mEditorListener.add(listener);
}
+ /**
+ * Removes the annotation listener.
+ *
+ * @param listener the listener
+ */
public void removeAnnotationListener(IAnnotationEditorModifyListener listener) {
mEditorListener.remove(listener);
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.caseditor.editor.ICasEditor#addCasEditorInputListener(org.apache.uima.caseditor.editor.ICasEditorInputListener)
+ */
+ @Override
public void addCasEditorInputListener(ICasEditorInputListener listener) {
mEditorInputListener.add(listener);
}
+ /* (non-Javadoc)
+ * @see org.apache.uima.caseditor.editor.ICasEditor#removeCasEditorInputListener(org.apache.uima.caseditor.editor.ICasEditorInputListener)
+ */
+ @Override
public void removeCasEditorInputListener(ICasEditorInputListener listener) {
mEditorInputListener.remove(listener);
}
@@ -1304,8 +1511,8 @@ public final class AnnotationEditor exte
/**
* Highlights the given range in the editor.
*
- * @param start
- * @param length
+ * @param start the start
+ * @param length the length
*/
private void highlight(int start, int length) {
ISourceViewer sourceViewer = getSourceViewer();
@@ -1380,6 +1587,11 @@ public final class AnnotationEditor exte
return getSourceViewer().getTextWidget().getCaretOffset();
}
+ /**
+ * Show view.
+ *
+ * @param viewName the view name
+ */
public void showView(String viewName) {
// TODO: Check if set view is compatible .. if not display some message!
@@ -1445,6 +1657,7 @@ public final class AnnotationEditor exte
if (mAnnotationStyleListener == null) {
mAnnotationStyleListener = new AnnotationStyleChangeListener() {
+ @Override
public void annotationStylesChanged(Collection<AnnotationStyle> styles) {
// TODO: Only sync changed types
syncAnnotationTypes();
@@ -1492,9 +1705,10 @@ public final class AnnotationEditor exte
/**
* Notifies the current instance about selection changes in the workbench.
*
- * @param part
- * @param selection
+ * @param part the part
+ * @param selection the selection
*/
+ @Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if (selection instanceof StructuredSelection) {
@@ -1545,6 +1759,11 @@ public final class AnnotationEditor exte
}
}
+ /**
+ * Checks if is something selected.
+ *
+ * @return true, if is something selected
+ */
private boolean isSomethingSelected() {
// TODO: sometimes we get a NPE here ...
// getSourceViewer() returns null here ... but why ?
@@ -1577,11 +1796,11 @@ public final class AnnotationEditor exte
/**
* Creates custom annotation actions:
- *
+ *
* Annotate Action
* Smart Annotate Action
* Delete Annotations Action
- * Find Annotate Action
+ * Find Annotate Action.
*/
@Override
protected void createActions() {
@@ -1652,6 +1871,9 @@ public final class AnnotationEditor exte
getSite().getSelectionProvider().addSelectionChangedListener(wideRightAnnotationSideAction);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.AbstractTextEditor#dispose()
+ */
@Override
public void dispose() {
// remove selection listener
@@ -1679,12 +1901,19 @@ public final class AnnotationEditor exte
super.dispose();
}
+ /**
+ * Sets the annotation selection.
+ *
+ * @param annotation the new annotation selection
+ */
void setAnnotationSelection(AnnotationFS annotation) {
mFeatureStructureSelectionProvider.setSelection(getDocument(), annotation);
}
/**
* Creates a list of all {@link AnnotationEditor} which are currently opened.
+ *
+ * @return the annotation editors
*/
public static AnnotationEditor[] getAnnotationEditors() {
@@ -1710,6 +1939,9 @@ public final class AnnotationEditor exte
return dirtyParts.toArray(new AnnotationEditor[dirtyParts.size()]);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.StatusTextEditor#createStatusControl(org.eclipse.swt.widgets.Composite, org.eclipse.core.runtime.IStatus)
+ */
@Override
protected Control createStatusControl(Composite parent, IStatus status) {
@@ -1762,11 +1994,13 @@ public final class AnnotationEditor exte
switchView.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetSelected(SelectionEvent e) {
// TODO; Switch to selected view in combo ...
showView(viewSelectionCombo.getText());
}
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
@@ -1783,6 +2017,11 @@ public final class AnnotationEditor exte
/**
* Retrieves the annotations in the given span.
+ *
+ * @param cas the cas
+ * @param type the type
+ * @param span the span
+ * @return the annotation
*/
static Collection<AnnotationFS> getAnnotation(CAS cas, Type type, Span span) {
ConstraintFactory cf = cas.getConstraintFactory();
@@ -1821,6 +2060,9 @@ public final class AnnotationEditor exte
/**
* Retrieves the view map.
+ *
+ * @param annotationType the annotation type
+ * @return the view
*/
private Map<Integer, AnnotationFS> getView(Type annotationType) {
Collection<AnnotationFS> annotations = getDocument().getAnnotations(annotationType);
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorActionContributor.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorActionContributor.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorActionContributor.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorActionContributor.java Sun Nov 13 16:13:16 2016
@@ -25,6 +25,7 @@ import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.part.EditorActionBarContributor;
import org.eclipse.ui.texteditor.StatusLineContributionItem;
+// TODO: Auto-generated Javadoc
/**
* The <code>AnnotationEditor</code> action contributor.
*
@@ -36,14 +37,16 @@ public class AnnotationEditorActionContr
*/
public static final String ID = "org.apache.uima.caseditor.editor.mode.status";
+ /** The m active editor part. */
private AnnotationEditor mActiveEditorPart;
+ /** The m status line mode item. */
private StatusLineContributionItem mStatusLineModeItem;
/**
* Sets the active editor.
*
- * @param part
+ * @param part the new active editor
*/
@Override
public void setActiveEditor(IEditorPart part) {
@@ -65,7 +68,7 @@ public class AnnotationEditorActionContr
/**
* Contributes the status item to the status line.
*
- * @param statusLineManager
+ * @param statusLineManager the status line manager
*/
@Override
public void contributeToStatusLine(IStatusLineManager statusLineManager) {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferenceConstants.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferenceConstants.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferenceConstants.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferenceConstants.java Sun Nov 13 16:13:16 2016
@@ -21,14 +21,21 @@ package org.apache.uima.caseditor.editor
import org.apache.uima.caseditor.CasEditorPlugin;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class AnnotationEditorPreferenceConstants.
+ */
public class AnnotationEditorPreferenceConstants {
+ /** The Constant ANNOTATION_EDITOR_TEXT_SIZE. */
public static final String ANNOTATION_EDITOR_TEXT_SIZE =
CasEditorPlugin.ID + ".editor-text-size";
+ /** The Constant EDITOR_LINE_LENGTH_HINT. */
public static final String EDITOR_LINE_LENGTH_HINT =
"EDITOR_LINE_LENGTH_HINT";
+ /** The Constant ANNOTATION_EDITOR_PARTIAL_TYPESYSTEM. */
public static final String ANNOTATION_EDITOR_PARTIAL_TYPESYSTEM = "ANNOTATION_EDITOR_PARTIAL_TYPESYSTEM";
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferenceInitializer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferenceInitializer.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferenceInitializer.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferenceInitializer.java Sun Nov 13 16:13:16 2016
@@ -23,9 +23,17 @@ import org.apache.uima.caseditor.CasEdit
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class AnnotationEditorPreferenceInitializer.
+ */
public class AnnotationEditorPreferenceInitializer extends AbstractPreferenceInitializer {
- public void initializeDefaultPreferences() {
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
IPreferenceStore store = CasEditorPlugin.getDefault().getPreferenceStore();
store.setDefault(AnnotationEditorPreferenceConstants.EDITOR_LINE_LENGTH_HINT, 80);
store.setDefault(AnnotationEditorPreferenceConstants.ANNOTATION_EDITOR_TEXT_SIZE, 13);
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferencePage.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferencePage.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferencePage.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferencePage.java Sun Nov 13 16:13:16 2016
@@ -26,22 +26,34 @@ import org.eclipse.jface.preference.Inte
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
+// TODO: Auto-generated Javadoc
/**
* Preference page to manage preferences for the Annotation Editor.
*/
public class AnnotationEditorPreferencePage extends FieldEditorPreferencePage
implements IWorkbenchPreferencePage {
+ /** The m editor line length hint. */
private IntegerFieldEditor mEditorLineLengthHint;
+
+ /** The m editor text size. */
private IntegerFieldEditor mEditorTextSize;
+
+ /** The m editor partial typeystem. */
private BooleanFieldEditor mEditorPartialTypeystem;
+ /**
+ * Instantiates a new annotation editor preference page.
+ */
public AnnotationEditorPreferencePage() {
setPreferenceStore(CasEditorPlugin.getDefault().getPreferenceStore());
setDescription("UIMA Annotation Editor Preferences.");
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
@Override
protected void createFieldEditors() {
// editor line length hint
@@ -64,9 +76,16 @@ public class AnnotationEditorPreferenceP
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ @Override
public void init(IWorkbench workbench) {
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#checkState()
+ */
@Override
protected void checkState() {
super.checkState();
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorSelection.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorSelection.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorSelection.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorSelection.java Sun Nov 13 16:13:16 2016
@@ -25,57 +25,113 @@ import java.util.List;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class AnnotationEditorSelection.
+ */
class AnnotationEditorSelection implements ITextSelection, IStructuredSelection {
+ /** The text selection. */
private ITextSelection textSelection;
+ /** The structured selection. */
private IStructuredSelection structuredSelection;
+ /**
+ * Instantiates a new annotation editor selection.
+ *
+ * @param textSelection the text selection
+ * @param structuredSelection the structured selection
+ */
AnnotationEditorSelection(ITextSelection textSelection, IStructuredSelection structuredSelection) {
this.textSelection = textSelection;
this.structuredSelection = structuredSelection;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.ITextSelection#getOffset()
+ */
+ @Override
public int getOffset() {
return textSelection.getOffset();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.ITextSelection#getLength()
+ */
+ @Override
public int getLength() {
return textSelection.getLength();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.ITextSelection#getStartLine()
+ */
+ @Override
public int getStartLine() {
return textSelection.getStartLine();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.ITextSelection#getEndLine()
+ */
+ @Override
public int getEndLine() {
return textSelection.getEndLine();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.ITextSelection#getText()
+ */
+ @Override
public String getText() {
return textSelection.getText();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelection#isEmpty()
+ */
+ @Override
public boolean isEmpty() {
return structuredSelection.isEmpty() && textSelection.isEmpty();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredSelection#getFirstElement()
+ */
+ @Override
public Object getFirstElement() {
return structuredSelection.getFirstElement();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredSelection#iterator()
+ */
+ @Override
public Iterator iterator() {
return structuredSelection.iterator();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredSelection#size()
+ */
+ @Override
public int size() {
return structuredSelection.size();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredSelection#toArray()
+ */
+ @Override
public Object[] toArray() {
return structuredSelection.toArray();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredSelection#toList()
+ */
+ @Override
public List toList() {
return structuredSelection.toList();
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorView.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorView.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorView.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorView.java Sun Nov 13 16:13:16 2016
@@ -27,18 +27,28 @@ import org.eclipse.ui.part.MessagePage;
import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.part.PageBookView;
+// TODO: Auto-generated Javadoc
/**
* Base view for views which show information about the {@link CAS} opened
* in the editor.
*/
public abstract class AnnotationEditorView extends PageBookView {
+ /** The editor not available message. */
private final String editorNotAvailableMessage;
+ /**
+ * Instantiates a new annotation editor view.
+ *
+ * @param editorNotAvailableMessage the editor not available message
+ */
public AnnotationEditorView(String editorNotAvailableMessage) {
this.editorNotAvailableMessage = editorNotAvailableMessage;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#createDefaultPage(org.eclipse.ui.part.PageBook)
+ */
@Override
protected IPage createDefaultPage(PageBook book) {
MessagePage page = new MessagePage();
@@ -48,8 +58,17 @@ public abstract class AnnotationEditorVi
return page;
}
+ /**
+ * Do create page.
+ *
+ * @param editor the editor
+ * @return the page rec
+ */
protected abstract PageRec doCreatePage(ICasEditor editor);
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#doCreatePage(org.eclipse.ui.IWorkbenchPart)
+ */
@Override
protected final PageRec doCreatePage(IWorkbenchPart part) {
@@ -62,11 +81,17 @@ public abstract class AnnotationEditorVi
return null;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#getBootstrapPart()
+ */
@Override
protected IWorkbenchPart getBootstrapPart() {
return getSite().getPage().getActiveEditor();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#doDestroyPage(org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.part.PageBookView.PageRec)
+ */
@Override
protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
pageRecord.page.dispose();
@@ -74,6 +99,9 @@ public abstract class AnnotationEditorVi
pageRecord.dispose();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#isImportant(org.eclipse.ui.IWorkbenchPart)
+ */
@Override
protected boolean isImportant(IWorkbenchPart part) {
// only interested in annotation editors
@@ -83,7 +111,7 @@ public abstract class AnnotationEditorVi
/**
* Look at {@link IPartListener#partBroughtToTop(IWorkbenchPart)}.
*
- * @param part
+ * @param part the part
*/
@Override
public void partBroughtToTop(IWorkbenchPart part) {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationInformationProvider.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationInformationProvider.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationInformationProvider.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationInformationProvider.java Sun Nov 13 16:13:16 2016
@@ -29,23 +29,32 @@ import org.eclipse.jface.text.informatio
import org.eclipse.jface.text.information.IInformationProviderExtension;
import org.eclipse.swt.graphics.Point;
+// TODO: Auto-generated Javadoc
/**
* TODO: move this class to external file.
*/
class AnnotationInformationProvider implements IInformationProvider, IInformationProviderExtension {
+
+ /** The m editor. */
private AnnotationEditor mEditor;
+ /**
+ * Instantiates a new annotation information provider.
+ *
+ * @param editor the editor
+ */
AnnotationInformationProvider(AnnotationEditor editor) {
mEditor = editor;
}
/**
- * TODO: add comment
+ * TODO: add comment.
*
- * @param textViewer
- * @param offset
+ * @param textViewer the text viewer
+ * @param offset the offset
* @return the region
*/
+ @Override
public IRegion getSubject(ITextViewer textViewer, int offset) {
Point selection = textViewer.getTextWidget().getSelection();
@@ -54,23 +63,25 @@ class AnnotationInformationProvider impl
}
/**
- * TODO: add comment
+ * TODO: add comment.
*
- * @param textViewer
- * @param subject
+ * @param textViewer the text viewer
+ * @param subject the subject
* @return null
*/
+ @Override
public String getInformation(ITextViewer textViewer, IRegion subject) {
return null;
}
/**
- * TODO: add comment
+ * TODO: add comment.
*
- * @param textViewer
- * @param subject
+ * @param textViewer the text viewer
+ * @param subject the subject
* @return the selected annotation
*/
+ @Override
public Object getInformation2(ITextViewer textViewer, IRegion subject) {
List<AnnotationFS> selection = mEditor.getSelectedAnnotations();
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationSelectionListener.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationSelectionListener.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationSelectionListener.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationSelectionListener.java Sun Nov 13 16:13:16 2016
@@ -26,14 +26,25 @@ import org.eclipse.jface.viewers.ISelect
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;
+// TODO: Auto-generated Javadoc
/**
- * TODO: add javadoc here
+ * TODO: add javadoc here.
+
*/
public abstract class AnnotationSelectionListener implements ISelectionListener {
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
}
+ /**
+ * Selected annotation.
+ *
+ * @param annotations the annotations
+ */
protected abstract void selectedAnnotation(Collection<AnnotationFS> annotations);
/**
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationStyle.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationStyle.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationStyle.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationStyle.java Sun Nov 13 16:13:16 2016
@@ -27,6 +27,7 @@ import org.apache.uima.caseditor.core.mo
import org.eclipse.jface.preference.IPreferenceStore;
+// TODO: Auto-generated Javadoc
/**
* The <code>AnnotationStyle</code> describes the look of an certain annotation type in the
* <code>AnnotationEditor</code>.
@@ -72,6 +73,7 @@ public final class AnnotationStyle {
*/
BRACKET,
+ /** The tag. */
TAG
}
@@ -85,16 +87,22 @@ public final class AnnotationStyle {
*/
public static final Color DEFAULT_COLOR = new Color(0xff, 0, 0);
+ /** The Constant DEFAULT_LAYER. */
public static final int DEFAULT_LAYER = 0;
+ /** The annotation. */
private final String annotation;
+ /** The style. */
private final Style style;
+ /** The color. */
private final Color color;
+ /** The layer. */
private final int layer;
+ /** The configuration. */
private final String configuration;
/**
@@ -129,6 +137,14 @@ public final class AnnotationStyle {
this.configuration = configuration;
}
+ /**
+ * Instantiates a new annotation style.
+ *
+ * @param annotation the annotation
+ * @param style the style
+ * @param color the color
+ * @param layer the layer
+ */
public AnnotationStyle(String annotation, Style style, Color color, int layer) {
this(annotation, style, color, layer, null);
}
@@ -169,12 +185,20 @@ public final class AnnotationStyle {
return layer;
}
+ /**
+ * Gets the configuration.
+ *
+ * @return the configuration
+ */
public String getConfiguration() {
return configuration;
}
/**
* Compares if current is equal to another object.
+ *
+ * @param object the object
+ * @return true, if successful
*/
@Override
public boolean equals(Object object) {
@@ -198,7 +222,9 @@ public final class AnnotationStyle {
}
/**
- * Generates a hash code using of toString()
+ * Generates a hash code using of toString().
+ *
+ * @return the int
*/
@Override
public int hashCode() {
@@ -207,6 +233,8 @@ public final class AnnotationStyle {
/**
* Represents this object as string.
+ *
+ * @return the string
*/
@Override
public String toString() {
@@ -223,6 +251,12 @@ public final class AnnotationStyle {
// key -> type name + ."style"
// value -> key/value pairs -> key=value; key=value;
// split on ";" and then split on = to parse values into a map
+ /**
+ * Serialize properties.
+ *
+ * @param properties the properties
+ * @return the string
+ */
// maybe make a util which can save a String, String map to a line, and load it from String ...
private static String serializeProperties(Map<String, String> properties) {
@@ -238,6 +272,12 @@ public final class AnnotationStyle {
return configString.toString();
}
+ /**
+ * Parses the properties.
+ *
+ * @param line the line
+ * @return the map
+ */
private static Map<String, String> parseProperties(String line) {
Map<String, String> properties = new HashMap<String, String>();
@@ -257,9 +297,9 @@ public final class AnnotationStyle {
/**
* Note: This method must not be called by user code! It is only public because the migration
* code in the Cas Editor Ide Plugin needs to access this method.
- *
- * @param store
- * @param style
+ *
+ * @param store the store
+ * @param style the style
*/
public static void putAnnotatationStyleToStore(IPreferenceStore store, AnnotationStyle style) {
@@ -284,9 +324,9 @@ public final class AnnotationStyle {
* <p>
* Note: This method must not be called by user code! It is only public because the migration
* code in the Cas Editor Ide Plugin needs to access this method.
- *
- * @param store
- * @param typeName
+ *
+ * @param store the store
+ * @param typeName the type name
* @return an annotation style from the provided preference store
*/
public static AnnotationStyle getAnnotationStyleFromStore(IPreferenceStore store, String typeName) {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationStyleChangeListener.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationStyleChangeListener.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationStyleChangeListener.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationStyleChangeListener.java Sun Nov 13 16:13:16 2016
@@ -25,6 +25,7 @@ import org.eclipse.jface.preference.IPre
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
+// TODO: Auto-generated Javadoc
/**
* Annotation Style Change Listener base class which converts annotation style change events from
* a Preference Store to AnnotationStyle object change events.
@@ -34,6 +35,10 @@ import org.eclipse.jface.util.PropertyCh
public abstract class AnnotationStyleChangeListener
implements IPropertyChangeListener, IAnnotationStyleListener {
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ @Override
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().endsWith(".style")) {
// extract type name ...
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ArrayValue.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ArrayValue.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ArrayValue.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ArrayValue.java Sun Nov 13 16:13:16 2016
@@ -32,12 +32,24 @@ import org.apache.uima.cas.StringArrayFS
import org.apache.uima.cas.text.AnnotationFS;
import org.eclipse.core.runtime.IAdaptable;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ArrayValue.
+ */
public class ArrayValue implements IAdaptable {
+ /** The array FS. */
private final FeatureStructure arrayFS;
+ /** The slot. */
private final int slot;
+ /**
+ * Instantiates a new array value.
+ *
+ * @param arrayFS the array FS
+ * @param slot the slot
+ */
public ArrayValue(FeatureStructure arrayFS, int slot) {
if (!arrayFS.getType().isArray()) {
@@ -48,14 +60,29 @@ public class ArrayValue implements IAdap
this.slot = slot;
}
+ /**
+ * Gets the feature structure.
+ *
+ * @return the feature structure
+ */
public FeatureStructure getFeatureStructure() {
return arrayFS;
}
+ /**
+ * Slot.
+ *
+ * @return the int
+ */
public int slot() {
return slot;
}
+ /**
+ * Sets the.
+ *
+ * @param value the value
+ */
public void set(String value) {
if (arrayFS instanceof BooleanArrayFS) {
@@ -87,6 +114,11 @@ public class ArrayValue implements IAdap
}
}
+ /**
+ * Gets the.
+ *
+ * @return the object
+ */
public Object get() {
if (arrayFS instanceof BooleanArrayFS) {
@@ -128,6 +160,10 @@ public class ArrayValue implements IAdap
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ @Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
if (FeatureStructure.class.equals(adapter)) {
@@ -149,6 +185,9 @@ public class ArrayValue implements IAdap
return null;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
@Override
public String toString() {
return Integer.toString(slot()) ;
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java Sun Nov 13 16:13:16 2016
@@ -32,6 +32,7 @@ import org.eclipse.swt.widgets.Composite
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.texteditor.IElementStateListener;
+// TODO: Auto-generated Javadoc
/**
* Provides the {@link org.apache.uima.caseditor.editor.ICasDocument} for the
* {@link AnnotationEditor}.
@@ -41,11 +42,22 @@ import org.eclipse.ui.texteditor.IElemen
*/
public abstract class CasDocumentProvider {
+ /**
+ * The Class ElementInfo.
+ */
protected static class ElementInfo {
+
+ /** The reference count. */
public int referenceCount;
+ /** The element. */
public final Object element;
+ /**
+ * Instantiates a new element info.
+ *
+ * @param element the element
+ */
protected ElementInfo(Object element) {
this.element = element;
}
@@ -56,6 +68,7 @@ public abstract class CasDocumentProvide
*/
public static final int TYPE_SYSTEM_NOT_AVAILABLE_STATUS_CODE = 12;
+ /** The element state listeners. */
private Set<IElementStateListener> elementStateListeners = new HashSet<IElementStateListener>();
/**
@@ -66,22 +79,53 @@ public abstract class CasDocumentProvide
*/
protected Map<Object, IStatus> elementErrorStatus = new HashMap<Object, IStatus>();
+ /**
+ * Creates the element info.
+ *
+ * @param element the element
+ * @return the element info
+ */
protected ElementInfo createElementInfo(Object element) {
return new ElementInfo(element);
}
+ /**
+ * Dispose element info.
+ *
+ * @param element the element
+ * @param info the info
+ */
protected void disposeElementInfo(Object element, ElementInfo info) {
}
/**
* Creates the a new {@link AnnotationDocument} from the given {@link IEditorInput} element. For
* all other elements null is returned.
+ *
+ * @param element the element
+ * @return the i cas document
+ * @throws CoreException the core exception
*/
protected abstract ICasDocument createDocument(Object element) throws CoreException;
+ /**
+ * Do save document.
+ *
+ * @param monitor the monitor
+ * @param element the element
+ * @param document the document
+ * @param overwrite the overwrite
+ * @throws CoreException the core exception
+ */
protected abstract void doSaveDocument(IProgressMonitor monitor, Object element,
ICasDocument document, boolean overwrite) throws CoreException;
+ /**
+ * Gets the status.
+ *
+ * @param element the element
+ * @return the status
+ */
public IStatus getStatus(Object element) {
return elementErrorStatus.get(element);
}
@@ -90,23 +134,27 @@ public abstract class CasDocumentProvide
* Retrieves the persistent per type system preference store. This store is usually saved in
* relation to the type system, e.g. an ide plugin could save a preference file next to the type
* system file.
- *
- * @param element
+ *
+ * @param element the element
* @return the preference store or null if it cannot be retrieved, e.g no document was created for the input.
*/
// Problem: Keys maybe should be pre-fixed depending on the plugin which is storing values
// TODO: Should it be renamed to getPersistentPreferenceStore?
public abstract IPreferenceStore getTypeSystemPreferenceStore(Object element);
+ /**
+ * Save type system preference store.
+ *
+ * @param element the element
+ */
// Might fail silently, only log an error
public abstract void saveTypeSystemPreferenceStore(Object element);
/**
* Retrieves the session preference store. This preference store is used to store session data
* which should be used to initialize a freshly opened editor.
- *
- * @param element
- *
+ *
+ * @param element the element
* @return the session preference store
*/
public abstract IPreferenceStore getSessionPreferenceStore(Object element);
@@ -118,29 +166,63 @@ public abstract class CasDocumentProvide
// protected abstract void setEditorAnnotationStatus(Object element,
// EditorAnnotationStatus editorAnnotationStatus);
+ /**
+ * Creates the type system selector form.
+ *
+ * @param editor the editor
+ * @param parent the parent
+ * @param status the status
+ * @return the composite
+ */
public abstract Composite createTypeSystemSelectorForm(ICasEditor editor, Composite parent,
IStatus status);
+ /**
+ * Adds the element state listener.
+ *
+ * @param listener the listener
+ */
public void addElementStateListener(IElementStateListener listener) {
elementStateListeners.add(listener);
}
+ /**
+ * Removes the element state listener.
+ *
+ * @param listener the listener
+ */
public void removeElementStateListener(IElementStateListener listener) {
elementStateListeners.remove(listener);
}
+ /**
+ * Fire element deleted.
+ *
+ * @param element the element
+ */
protected void fireElementDeleted(Object element) {
for (IElementStateListener listener : elementStateListeners) {
listener.elementDeleted(element);
}
}
+ /**
+ * Fire element changed.
+ *
+ * @param element the element
+ */
protected void fireElementChanged(Object element) {
for (IElementStateListener listener : elementStateListeners) {
listener.elementContentReplaced(element);
}
}
+ /**
+ * Fire element dirty state changed.
+ *
+ * @param element the element
+ * @param isDirty the is dirty
+ */
protected void fireElementDirtyStateChanged(Object element, boolean isDirty) {
for (IElementStateListener listener : elementStateListeners) {
listener.elementDirtyStateChanged(element, isDirty);
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProviderFactory.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProviderFactory.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProviderFactory.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProviderFactory.java Sun Nov 13 16:13:16 2016
@@ -30,19 +30,26 @@ import org.eclipse.core.runtime.IConfigu
import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.IEditorInput;
+// TODO: Auto-generated Javadoc
/**
* Factory class to produce and lookup an appropriate document provider.
*/
class CasDocumentProviderFactory {
+ /** The Constant CAS_EDITOR_EXTENSION. */
// TODO: Change to: .documentProviders
private static final String CAS_EDITOR_EXTENSION = "org.apache.uima.caseditor.editor";
+ /** The instance. */
private static CasDocumentProviderFactory instance;
+ /** The document providers. */
// map class_name to provider
private Map<String, CasDocumentProvider> documentProviders = new HashMap<String, CasDocumentProvider>();
+ /**
+ * Instantiates a new cas document provider factory.
+ */
CasDocumentProviderFactory() {
IConfigurationElement[] config =
@@ -76,10 +83,9 @@ class CasDocumentProviderFactory {
* Looks up a document provider for the provided editor input.
* The editor input type must be cast-able to the specified inputType.
* The implementation tries first to map class types, and then interface types.
- *
- * @param input
- *
- * @return
+ *
+ * @param input the input
+ * @return the document provider
*/
CasDocumentProvider getDocumentProvider(IEditorInput input) {
@@ -119,6 +125,11 @@ class CasDocumentProviderFactory {
return provider;
}
+ /**
+ * Instance.
+ *
+ * @return the cas document provider factory
+ */
static CasDocumentProviderFactory instance() {
if (instance == null) {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorError.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorError.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorError.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorError.java Sun Nov 13 16:13:16 2016
@@ -19,18 +19,20 @@
package org.apache.uima.caseditor.editor;
+// TODO: Auto-generated Javadoc
/**
* A general {@link RuntimeException} which is thrown if something unexpected happens.
*/
public class CasEditorError extends RuntimeException {
+ /** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/**
* Initializes the current instance.
*
- * @param message
+ * @param message the message
*/
public CasEditorError(String message) {
super(message);
@@ -39,8 +41,8 @@ public class CasEditorError extends Runt
/**
* Initializes the current instance.
*
- * @param message
- * @param cause
+ * @param message the message
+ * @param cause the cause
*/
public CasEditorError(String message, Throwable cause) {
super(message, cause);
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorView.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorView.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorView.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorView.java Sun Nov 13 16:13:16 2016
@@ -34,6 +34,7 @@ import org.eclipse.ui.part.MessagePage;
import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.part.PageBookView;
+// TODO: Auto-generated Javadoc
/**
* Base class for views which show information about the {@link CAS} opened
* in the editor.
@@ -47,14 +48,22 @@ import org.eclipse.ui.part.PageBookView;
*/
public abstract class CasEditorView extends PageBookView {
+ /** The editor not available message. */
private final String editorNotAvailableMessage;
+ /** The editor listener map. */
private Map<ICasEditor, ICasEditorInputListener> editorListenerMap =
new HashMap<ICasEditor, ICasEditorInputListener>();
+ /** The document listener map. */
private Map<ICasEditor, ICasDocumentListener> documentListenerMap =
new HashMap<ICasEditor, ICasDocumentListener>();
+ /**
+ * Instantiates a new cas editor view.
+ *
+ * @param editorNotAvailableMessage the editor not available message
+ */
public CasEditorView(String editorNotAvailableMessage) {
this.editorNotAvailableMessage = editorNotAvailableMessage;
}
@@ -76,6 +85,9 @@ public abstract class CasEditorView exte
return false;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#createDefaultPage(org.eclipse.ui.part.PageBook)
+ */
@Override
protected IPage createDefaultPage(PageBook book) {
MessagePage page = new MessagePage();
@@ -86,9 +98,21 @@ public abstract class CasEditorView exte
}
// Creates a new page if document is available and CAS view is compatible
+ /**
+ * Do create page.
+ *
+ * @param editor the editor
+ * @return the i page book view page
+ */
// Will be recreated on view switch (need a flag to disable that) and input cas switch
protected abstract IPageBookViewPage doCreatePage(ICasEditor editor);
+ /**
+ * Creates the view page.
+ *
+ * @param casViewPageBookedPage the cas view page booked page
+ * @param editor the editor
+ */
private void createViewPage( CasEditorViewPage casViewPageBookedPage, ICasEditor editor) {
IPageBookViewPage page = doCreatePage(editor);
@@ -106,6 +130,9 @@ public abstract class CasEditorView exte
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#doCreatePage(org.eclipse.ui.IWorkbenchPart)
+ */
@Override
protected final PageRec doCreatePage(final IWorkbenchPart part) {
@@ -134,6 +161,7 @@ public abstract class CasEditorView exte
ICasEditorInputListener inputListener = new ICasEditorInputListener() {
+ @Override
public void casDocumentChanged(IEditorInput oldInput, ICasDocument oldDocument,
IEditorInput newInput, ICasDocument newDocument) {
@@ -169,11 +197,17 @@ public abstract class CasEditorView exte
return result;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#getBootstrapPart()
+ */
@Override
protected IWorkbenchPart getBootstrapPart() {
return getSite().getPage().getActiveEditor();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#doDestroyPage(org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.part.PageBookView.PageRec)
+ */
@Override
protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
@@ -197,6 +231,9 @@ public abstract class CasEditorView exte
pageRecord.dispose();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#isImportant(org.eclipse.ui.IWorkbenchPart)
+ */
@Override
protected boolean isImportant(IWorkbenchPart part) {
// only interested in annotation editors
@@ -206,13 +243,16 @@ public abstract class CasEditorView exte
/**
* Look at {@link IPartListener#partBroughtToTop(IWorkbenchPart)}.
*
- * @param part
+ * @param part the part
*/
@Override
public void partBroughtToTop(IWorkbenchPart part) {
partActivated(part);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.PageBookView#dispose()
+ */
@Override
public void dispose() {
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorViewPage.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorViewPage.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorViewPage.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorViewPage.java Sun Nov 13 16:13:16 2016
@@ -42,24 +42,42 @@ import org.eclipse.ui.part.IPageBookView
import org.eclipse.ui.part.Page;
import org.eclipse.ui.part.PageBook;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CasEditorViewPage.
+ */
public class CasEditorViewPage extends Page implements ISelectionProvider {
+ /** The selection changed listeners. */
private ListenerList selectionChangedListeners = new ListenerList();
+ /** The not available message. */
private final String notAvailableMessage;
+ /** The book. */
protected PageBook book;
+ /** The cas view page. */
protected IPageBookViewPage casViewPage;
+ /** The sub action bar. */
private SubActionBars subActionBar;
+ /** The message text. */
private Text messageText;
+ /**
+ * Instantiates a new cas editor view page.
+ *
+ * @param notAvailableMessage the not available message
+ */
protected CasEditorViewPage(String notAvailableMessage) {
this.notAvailableMessage = notAvailableMessage;
}
+ /**
+ * Refresh action handlers.
+ */
@SuppressWarnings("rawtypes")
private void refreshActionHandlers() {
@@ -80,15 +98,28 @@ public class CasEditorViewPage extends P
}
// These are called from the outside, even if the page is not active ...
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
+ */
// this leads to the processing of events which should not be processed!
+ @Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
selectionChangedListeners.add(listener);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
+ */
+ @Override
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
selectionChangedListeners.remove(listener);
}
+ /**
+ * Selection changed.
+ *
+ * @param event the event
+ */
public void selectionChanged(final SelectionChangedEvent event) {
for (Object listener : selectionChangedListeners.getListeners()) {
@@ -97,6 +128,7 @@ public class CasEditorViewPage extends P
(ISelectionChangedListener) listener;
SafeRunner.run(new SafeRunnable() {
+ @Override
public void run() {
selectionChangedListener.selectionChanged(event);
}
@@ -104,6 +136,10 @@ public class CasEditorViewPage extends P
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
+ */
+ @Override
public ISelection getSelection() {
if (casViewPage != null && casViewPage.getSite().getSelectionProvider() != null) {
return casViewPage.getSite().getSelectionProvider().getSelection();
@@ -113,12 +149,19 @@ public class CasEditorViewPage extends P
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
public void setSelection(ISelection selection) {
if (casViewPage != null && casViewPage.getSite().getSelectionProvider() != null) {
casViewPage.getSite().getSelectionProvider().setSelection(selection);
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.Page#createControl(org.eclipse.swt.widgets.Composite)
+ */
@Override
public void createControl(Composite parent) {
book = new PageBook(parent, SWT.NONE);
@@ -136,8 +179,8 @@ public class CasEditorViewPage extends P
/**
* Creates and shows the page, if page is null
* the not available message will be shown.
- *
- * @param page
+ *
+ * @param page the page
*/
protected void initializeAndShowPage(IPageBookViewPage page) {
if (book != null) {
@@ -149,6 +192,7 @@ public class CasEditorViewPage extends P
ISelectionProvider selectionProvider = page.getSite().getSelectionProvider();
selectionProvider.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
CasEditorViewPage.this.selectionChanged(event);
}
@@ -172,6 +216,11 @@ public class CasEditorViewPage extends P
}
}
+ /**
+ * Sets the CAS view page.
+ *
+ * @param page the new CAS view page
+ */
public void setCASViewPage(IPageBookViewPage page) {
if (book != null && casViewPage != null) {
@@ -184,16 +233,25 @@ public class CasEditorViewPage extends P
initializeAndShowPage(page);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.Page#getControl()
+ */
@Override
public Control getControl() {
return book;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.Page#setFocus()
+ */
@Override
public void setFocus() {
book.setFocus();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.Page#dispose()
+ */
@Override
public void dispose() {
super.dispose();
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ChangeModeAction.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ChangeModeAction.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ChangeModeAction.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ChangeModeAction.java Sun Nov 13 16:13:16 2016
@@ -22,6 +22,7 @@ package org.apache.uima.caseditor.editor
import org.apache.uima.cas.Type;
import org.eclipse.jface.action.Action;
+// TODO: Auto-generated Javadoc
/**
* The {@link ChangeModeAction} changes the editor annotation mode to the newly selected one.
*/
@@ -41,7 +42,7 @@ final class ChangeModeAction extends Act
*
* @param newMode -target mode
* @param name - name of the action
- * @param editor
+ * @param editor the editor
*/
ChangeModeAction(Type newMode, String name, AnnotationEditor editor) {
mMode = newMode;
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CustomInformationControl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CustomInformationControl.java?rev=1769512&r1=1769511&r2=1769512&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CustomInformationControl.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CustomInformationControl.java Sun Nov 13 16:13:16 2016
@@ -33,21 +33,26 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+// TODO: Auto-generated Javadoc
/**
- * TODO: add javadoc here
+ * TODO: add javadoc here.
*/
public class CustomInformationControl implements IInformationControl, IInformationControlExtension2 {
+
+ /** The m shell. */
private Shell mShell;
+ /** The m control. */
private Control mControl;
+ /** The m content handler. */
private ICustomInformationControlContentHandler mContentHandler;
/**
* Initializes a new instance.
*
- * @param parent
- * @param contentHandler
+ * @param parent the parent
+ * @param contentHandler the content handler
*/
public CustomInformationControl(Shell parent,
ICustomInformationControlContentHandler contentHandler) {
@@ -61,9 +66,9 @@ public class CustomInformationControl im
}
/**
- * Sets the viewer control
+ * Sets the viewer control.
*
- * @param viewerControl
+ * @param viewerControl the new control
*/
public void setControl(Control viewerControl) {
mControl = viewerControl;
@@ -79,27 +84,51 @@ public class CustomInformationControl im
return mShell;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IInformationControl#setInformation(java.lang.String)
+ */
+ @Override
public void setInformation(String information) {
// this method is replaced by the extension interface
// method setInput(...)
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IInformationControl#setSizeConstraints(int, int)
+ */
+ @Override
public void setSizeConstraints(int maxWidth, int maxHeight) {
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IInformationControl#computeSizeHint()
+ */
+ @Override
public Point computeSizeHint() {
return mShell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IInformationControl#setVisible(boolean)
+ */
+ @Override
public void setVisible(boolean visible) {
mControl.setVisible(visible);
mShell.setVisible(visible);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IInformationControl#setSize(int, int)
+ */
+ @Override
public void setSize(int width, int height) {
// mShell.setSize(width, height);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IInformationControl#setLocation(org.eclipse.swt.graphics.Point)
+ */
+ @Override
public void setLocation(Point location) {
Rectangle trim = mShell.computeTrim(0, 0, 0, 0);
@@ -110,51 +139,91 @@ public class CustomInformationControl im
mShell.setLocation(location);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IInformationControl#dispose()
+ */
+ @Override
public void dispose() {
if (mShell != null && !mShell.isDisposed()) {
mShell.dispose();
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IInformationControl#addDisposeListener(org.eclipse.swt.events.DisposeListener)
+ */
+ @Override
public void addDisposeListener(DisposeListener listener) {
mShell.addDisposeListener(listener);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IInformationControl#removeDisposeListener(org.eclipse.swt.events.DisposeListener)
+ */
+ @Override
public void removeDisposeListener(DisposeListener listener) {
mShell.removeDisposeListener(listener);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IInformationControl#setForegroundColor(org.eclipse.swt.graphics.Color)
+ */
+ @Override
public void setForegroundColor(Color foreground) {
mShell.setForeground(foreground);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IInformationControl#setBackgroundColor(org.eclipse.swt.graphics.Color)
+ */
+ @Override
public void setBackgroundColor(Color background) {
mShell.setBackground(background);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IInformationControl#isFocusControl()
+ */
+ @Override
public boolean isFocusControl() {
return mShell.isFocusControl();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IInformationControl#setFocus()
+ */
+ @Override
public void setFocus() {
mShell.setFocus();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IInformationControl#addFocusListener(org.eclipse.swt.events.FocusListener)
+ */
+ @Override
public void addFocusListener(FocusListener listener) {
mShell.addFocusListener(listener);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IInformationControl#removeFocusListener(org.eclipse.swt.events.FocusListener)
+ */
+ @Override
public void removeFocusListener(FocusListener listener) {
mShell.removeFocusListener(listener);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IInformationControlExtension2#setInput(java.lang.Object)
+ */
+ @Override
public void setInput(Object input) {
mContentHandler.setInput(this, input);
}
/**
- * Retrieves the control
+ * Retrieves the control.
*
* @return the control
*/