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 2019/07/22 12:23:56 UTC
svn commit: r1863543 [2/5] - in /uima/uimaj/trunk/uimaj-ep-cas-editor: ./
src/main/java/org/apache/uima/caseditor/
src/main/java/org/apache/uima/caseditor/core/
src/main/java/org/apache/uima/caseditor/core/model/
src/main/java/org/apache/uima/caseditor...
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferenceInitializer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferenceInitializer.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferenceInitializer.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferenceInitializer.java Mon Jul 22 12:23:55 2019
@@ -23,12 +23,16 @@ import org.apache.uima.caseditor.CasEdit
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
+/**
+ * The Class AnnotationEditorPreferenceInitializer.
+ */
public class AnnotationEditorPreferenceInitializer extends AbstractPreferenceInitializer {
- public void initializeDefaultPreferences() {
- IPreferenceStore store = CasEditorPlugin.getDefault().getPreferenceStore();
- store.setDefault(AnnotationEditorPreferenceConstants.EDITOR_LINE_LENGTH_HINT, 80);
- store.setDefault(AnnotationEditorPreferenceConstants.ANNOTATION_EDITOR_TEXT_SIZE, 13);
+ @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);
store.setDefault(AnnotationEditorPreferenceConstants.ANNOTATION_EDITOR_PARTIAL_TYPESYSTEM, false);
- }
+ }
}
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferencePage.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferencePage.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferencePage.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorPreferencePage.java Mon Jul 22 12:23:55 2019
@@ -26,21 +26,26 @@ import org.eclipse.jface.preference.Inte
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
+
/**
* 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;
- private IntegerFieldEditor mEditorTextSize;
- private BooleanFieldEditor mEditorPartialTypeystem;
+ /** The m editor text size. */
+ private IntegerFieldEditor mEditorTextSize;
+
+ /**
+ * Instantiates a new annotation editor preference page.
+ */
public AnnotationEditorPreferencePage() {
setPreferenceStore(CasEditorPlugin.getDefault().getPreferenceStore());
setDescription("UIMA Annotation Editor Preferences.");
}
-
@Override
protected void createFieldEditors() {
@@ -57,16 +62,17 @@ public class AnnotationEditorPreferenceP
addField(mEditorTextSize);
// load CAS with partial type system
- mEditorPartialTypeystem = new BooleanFieldEditor(
- AnnotationEditorPreferenceConstants.ANNOTATION_EDITOR_PARTIAL_TYPESYSTEM,
- "Load CAS leniently (WARNING: only for experienced users)", getFieldEditorParent());
- addField(mEditorPartialTypeystem);
+ BooleanFieldEditor editorPartialTypesystem = new BooleanFieldEditor(
+ AnnotationEditorPreferenceConstants.ANNOTATION_EDITOR_PARTIAL_TYPESYSTEM,
+ "Load CAS leniently (WARNING: only for experienced users)", getFieldEditorParent());
+ addField(editorPartialTypesystem);
}
+ @Override
public void init(IWorkbench workbench) {
}
-
+
@Override
protected void checkState() {
super.checkState();
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorSelection.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorSelection.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorSelection.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorSelection.java Mon Jul 22 12:23:55 2019
@@ -25,57 +25,80 @@ import java.util.List;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * 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;
}
-
+
+ @Override
public int getOffset() {
return textSelection.getOffset();
}
+ @Override
public int getLength() {
return textSelection.getLength();
}
+ @Override
public int getStartLine() {
return textSelection.getStartLine();
}
+ @Override
public int getEndLine() {
return textSelection.getEndLine();
}
+ @Override
public String getText() {
return textSelection.getText();
}
+ @Override
public boolean isEmpty() {
return structuredSelection.isEmpty() && textSelection.isEmpty();
}
+ @Override
public Object getFirstElement() {
return structuredSelection.getFirstElement();
}
+ @Override
public Iterator iterator() {
return structuredSelection.iterator();
}
+ @Override
public int size() {
return structuredSelection.size();
}
+ @Override
public Object[] toArray() {
return structuredSelection.toArray();
}
+ @Override
public List toList() {
return structuredSelection.toList();
}
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorView.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorView.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorView.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorView.java Mon Jul 22 12:23:55 2019
@@ -27,14 +27,21 @@ import org.eclipse.ui.part.MessagePage;
import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.part.PageBookView;
+
/**
* 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;
}
@@ -48,6 +55,12 @@ public abstract class AnnotationEditorVi
return page;
}
+ /**
+ * Do create page.
+ *
+ * @param editor the editor
+ * @return the page rec
+ */
protected abstract PageRec doCreatePage(ICasEditor editor);
@Override
@@ -83,7 +96,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/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationInformationProvider.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationInformationProvider.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationInformationProvider.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationInformationProvider.java Mon Jul 22 12:23:55 2019
@@ -29,23 +29,32 @@ import org.eclipse.jface.text.informatio
import org.eclipse.jface.text.information.IInformationProviderExtension;
import org.eclipse.swt.graphics.Point;
+
/**
* 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/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationSelectionListener.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationSelectionListener.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationSelectionListener.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationSelectionListener.java Mon Jul 22 12:23:55 2019
@@ -26,14 +26,22 @@ import org.eclipse.jface.viewers.ISelect
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;
+
/**
- * TODO: add javadoc here
+ * TODO: add javadoc here.
+
*/
public abstract class AnnotationSelectionListener implements ISelectionListener {
+ @Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
}
+ /**
+ * Selected annotation.
+ *
+ * @param annotations the annotations
+ */
protected abstract void selectedAnnotation(Collection<AnnotationFS> annotations);
/**
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationStyle.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationStyle.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationStyle.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationStyle.java Mon Jul 22 12:23:55 2019
@@ -22,11 +22,13 @@ package org.apache.uima.caseditor.editor
import java.awt.Color;
import java.util.HashMap;
import java.util.Map;
+import java.util.Objects;
import org.apache.uima.caseditor.core.model.DefaultColors;
import org.eclipse.jface.preference.IPreferenceStore;
+
/**
* The <code>AnnotationStyle</code> describes the look of an certain annotation type in the
* <code>AnnotationEditor</code>.
@@ -72,6 +74,7 @@ public final class AnnotationStyle {
*/
BRACKET,
+ /** The tag. */
TAG
}
@@ -85,16 +88,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 +138,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 +186,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) {
@@ -185,9 +210,8 @@ public final class AnnotationStyle {
} else if (object instanceof AnnotationStyle) {
AnnotationStyle style = (AnnotationStyle) object;
- boolean isConfigEqual = configuration == style.configuration ||
- (configuration != null ? false : configuration.equals(style.configuration));
-
+ boolean isConfigEqual = Objects.equals(configuration, style.configuration);
+
isEqual = annotation.equals(style.annotation) && this.style.equals(style.style)
&& color.equals(style.color) && layer == style.layer && isConfigEqual;
} else {
@@ -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,8 +272,14 @@ 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>();
+ Map<String, String> properties = new HashMap<>();
String keyValueStrings[] = line.split(";");
@@ -257,16 +297,16 @@ 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) {
Color color = new Color(style.getColor().getRed(), style.getColor().getGreen(),
style.getColor().getBlue());
- Map<String, String> styleProperties = new HashMap<String, String>();
+ Map<String, String> styleProperties = new HashMap<>();
styleProperties.put("color", Integer.toString(color.getRGB()));
styleProperties.put("strategy", style.getStyle().toString());
@@ -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/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationStyleChangeListener.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationStyleChangeListener.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationStyleChangeListener.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationStyleChangeListener.java Mon Jul 22 12:23:55 2019
@@ -25,6 +25,7 @@ import org.eclipse.jface.preference.IPre
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
+
/**
* Annotation Style Change Listener base class which converts annotation style change events from
* a Preference Store to AnnotationStyle object change events.
@@ -34,6 +35,7 @@ import org.eclipse.jface.util.PropertyCh
public abstract class AnnotationStyleChangeListener
implements IPropertyChangeListener, IAnnotationStyleListener {
+ @Override
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().endsWith(".style")) {
// extract type name ...
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ArrayValue.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ArrayValue.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ArrayValue.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ArrayValue.java Mon Jul 22 12:23:55 2019
@@ -32,12 +32,24 @@ import org.apache.uima.cas.StringArrayFS
import org.apache.uima.cas.text.AnnotationFS;
import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * 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) {
@@ -83,10 +110,15 @@ public class ArrayValue implements IAdap
StringArrayFS array = (StringArrayFS) arrayFS;
array.set(slot, value);
} else {
- throw new CasEditorError("Unkown array type!");
+ throw new CasEditorError("Unknown array type!");
}
}
+ /**
+ * Gets the.
+ *
+ * @return the object
+ */
public Object get() {
if (arrayFS instanceof BooleanArrayFS) {
@@ -124,10 +156,11 @@ public class ArrayValue implements IAdap
ArrayFS array = (ArrayFS) arrayFS;
return array.get(slot);
} else {
- throw new CasEditorError("Unkown array type!");
+ throw new CasEditorError("Unknown array type!");
}
}
+ @Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
if (FeatureStructure.class.equals(adapter)) {
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java Mon Jul 22 12:23:55 2019
@@ -32,6 +32,7 @@ import org.eclipse.swt.widgets.Composite
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.texteditor.IElementStateListener;
+
/**
* 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,7 +68,8 @@ public abstract class CasDocumentProvide
*/
public static final int TYPE_SYSTEM_NOT_AVAILABLE_STATUS_CODE = 12;
- private Set<IElementStateListener> elementStateListeners = new HashSet<IElementStateListener>();
+ /** The element state listeners. */
+ private Set<IElementStateListener> elementStateListeners = new HashSet<>();
/**
* The method {@link #createDocument(Object)} put error status objects for the given element in
@@ -64,24 +77,55 @@ public abstract class CasDocumentProvide
*
* The method {@link #getStatus(Object)} can then retrieve and return the status.
*/
- protected Map<Object, IStatus> elementErrorStatus = new HashMap<Object, IStatus>();
+ protected Map<Object, IStatus> elementErrorStatus = new HashMap<>();
+ /**
+ * 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/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProviderFactory.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProviderFactory.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProviderFactory.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProviderFactory.java Mon Jul 22 12:23:55 2019
@@ -30,19 +30,26 @@ import org.eclipse.core.runtime.IConfigu
import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.IEditorInput;
+
/**
* 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>();
+ private Map<String, CasDocumentProvider> documentProviders = new HashMap<>();
+ /**
+ * Instantiates a new cas document provider factory.
+ */
CasDocumentProviderFactory() {
IConfigurationElement[] config =
@@ -60,7 +67,7 @@ class CasDocumentProviderFactory {
try {
documentProviderObject = element.createExecutableExtension("class");
} catch (CoreException e) {
- CasEditorPlugin.log("Failed to load doucment provider with id: " + id, e);
+ CasEditorPlugin.log("Failed to load document provider with id: " + id, e);
documentProviderObject = null;
}
@@ -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) {
@@ -88,7 +94,7 @@ class CasDocumentProviderFactory {
// First try to match the input type to the editor input type
// or one of its super class
- List<Class<?>> classList = new ArrayList<Class<?>>();
+ List<Class<?>> classList = new ArrayList<>();
for (Class<?> inputClass = input.getClass(); inputClass != null;) {
classList.add(inputClass);
@@ -119,6 +125,11 @@ class CasDocumentProviderFactory {
return provider;
}
+ /**
+ * Instance.
+ *
+ * @return the cas document provider factory
+ */
static CasDocumentProviderFactory instance() {
if (instance == null) {
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorError.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorError.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorError.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorError.java Mon Jul 22 12:23:55 2019
@@ -19,18 +19,20 @@
package org.apache.uima.caseditor.editor;
+
/**
* 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/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorView.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorView.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorView.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorView.java Mon Jul 22 12:23:55 2019
@@ -34,6 +34,7 @@ import org.eclipse.ui.part.MessagePage;
import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.part.PageBookView;
+
/**
* 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>();
+ new HashMap<>();
+ /** The document listener map. */
private Map<ICasEditor, ICasDocumentListener> documentListenerMap =
- new HashMap<ICasEditor, ICasDocumentListener>();
+ new HashMap<>();
+ /**
+ * Instantiates a new cas editor view.
+ *
+ * @param editorNotAvailableMessage the editor not available message
+ */
public CasEditorView(String editorNotAvailableMessage) {
this.editorNotAvailableMessage = editorNotAvailableMessage;
}
@@ -75,7 +84,7 @@ public abstract class CasEditorView exte
protected boolean isRecreatePageOnCASViewSwitch() {
return false;
}
-
+
@Override
protected IPage createDefaultPage(PageBook book) {
MessagePage page = new MessagePage();
@@ -86,9 +95,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);
@@ -105,7 +126,7 @@ public abstract class CasEditorView exte
casViewPageBookedPage.setCASViewPage(null);
}
}
-
+
@Override
protected final PageRec doCreatePage(final IWorkbenchPart part) {
@@ -134,6 +155,7 @@ public abstract class CasEditorView exte
ICasEditorInputListener inputListener = new ICasEditorInputListener() {
+ @Override
public void casDocumentChanged(IEditorInput oldInput, ICasDocument oldDocument,
IEditorInput newInput, ICasDocument newDocument) {
@@ -206,13 +228,13 @@ 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);
}
-
+
@Override
public void dispose() {
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorViewPage.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorViewPage.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorViewPage.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CasEditorViewPage.java Mon Jul 22 12:23:55 2019
@@ -19,7 +19,6 @@
package org.apache.uima.caseditor.editor;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -42,37 +41,52 @@ import org.eclipse.ui.part.IPageBookView
import org.eclipse.ui.part.Page;
import org.eclipse.ui.part.PageBook;
+
+/**
+ * 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() {
IActionBars actionBars = getSite().getActionBars();
actionBars.clearGlobalActionHandlers();
- Map newActionHandlers = subActionBar
- .getGlobalActionHandlers();
+ Map newActionHandlers = subActionBar.getGlobalActionHandlers();
if (newActionHandlers != null) {
- Set keys = newActionHandlers.entrySet();
- Iterator iter = keys.iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry) iter.next();
+ Set<Map.Entry> keys = newActionHandlers.entrySet();
+ for (Map.Entry entry : keys) {
actionBars.setGlobalActionHandler((String) entry.getKey(),
(IAction) entry.getValue());
}
@@ -81,14 +95,21 @@ public class CasEditorViewPage extends P
// These are called from the outside, even if the page is not active ...
// this leads to the processing of events which should not be processed!
+ @Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
selectionChangedListeners.add(listener);
}
+ @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 +118,7 @@ public class CasEditorViewPage extends P
(ISelectionChangedListener) listener;
SafeRunner.run(new SafeRunnable() {
+ @Override
public void run() {
selectionChangedListener.selectionChanged(event);
}
@@ -104,6 +126,7 @@ public class CasEditorViewPage extends P
}
}
+ @Override
public ISelection getSelection() {
if (casViewPage != null && casViewPage.getSite().getSelectionProvider() != null) {
return casViewPage.getSite().getSelectionProvider().getSelection();
@@ -113,6 +136,7 @@ public class CasEditorViewPage extends P
}
}
+ @Override
public void setSelection(ISelection selection) {
if (casViewPage != null && casViewPage.getSite().getSelectionProvider() != null) {
casViewPage.getSite().getSelectionProvider().setSelection(selection);
@@ -136,8 +160,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) {
@@ -147,12 +171,7 @@ public class CasEditorViewPage extends P
// Note: If page is in background event listening must be disabled!
ISelectionProvider selectionProvider = page.getSite().getSelectionProvider();
- selectionProvider.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- CasEditorViewPage.this.selectionChanged(event);
- }
- });
+ selectionProvider.addSelectionChangedListener(CasEditorViewPage.this::selectionChanged);
subActionBar = (SubActionBars) casViewPage.getSite().getActionBars();
@@ -172,6 +191,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) {
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ChangeModeAction.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ChangeModeAction.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ChangeModeAction.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ChangeModeAction.java Mon Jul 22 12:23:55 2019
@@ -22,6 +22,7 @@ package org.apache.uima.caseditor.editor
import org.apache.uima.cas.Type;
import org.eclipse.jface.action.Action;
+
/**
* 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/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CustomInformationControl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CustomInformationControl.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CustomInformationControl.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/CustomInformationControl.java Mon Jul 22 12:23:55 2019
@@ -33,21 +33,26 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+
/**
- * 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,33 @@ public class CustomInformationControl im
return mShell;
}
+ @Override
public void setInformation(String information) {
// this method is replaced by the extension interface
// method setInput(...)
}
+ @Override
public void setSizeConstraints(int maxWidth, int maxHeight) {
}
+ @Override
public Point computeSizeHint() {
return mShell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
}
+ @Override
public void setVisible(boolean visible) {
mControl.setVisible(visible);
mShell.setVisible(visible);
}
+ @Override
public void setSize(int width, int height) {
// mShell.setSize(width, height);
}
+ @Override
public void setLocation(Point location) {
Rectangle trim = mShell.computeTrim(0, 0, 0, 0);
@@ -110,55 +121,64 @@ public class CustomInformationControl im
mShell.setLocation(location);
}
+ @Override
public void dispose() {
if (mShell != null && !mShell.isDisposed()) {
mShell.dispose();
}
}
+ @Override
public void addDisposeListener(DisposeListener listener) {
mShell.addDisposeListener(listener);
}
+ @Override
public void removeDisposeListener(DisposeListener listener) {
mShell.removeDisposeListener(listener);
}
+ @Override
public void setForegroundColor(Color foreground) {
mShell.setForeground(foreground);
}
+ @Override
public void setBackgroundColor(Color background) {
mShell.setBackground(background);
}
+ @Override
public boolean isFocusControl() {
return mShell.isFocusControl();
}
+ @Override
public void setFocus() {
mShell.setFocus();
}
+ @Override
public void addFocusListener(FocusListener listener) {
mShell.addFocusListener(listener);
}
+ @Override
public void removeFocusListener(FocusListener listener) {
mShell.removeFocusListener(listener);
}
+ @Override
public void setInput(Object input) {
mContentHandler.setInput(this, input);
-
}
/**
- * Retrieves the control
+ * Retrieves the control.
*
* @return the control
*/
public Control getControl() {
return mControl;
}
-}
\ No newline at end of file
+}
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/DocumentUimaImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/DocumentUimaImpl.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/DocumentUimaImpl.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/DocumentUimaImpl.java Mon Jul 22 12:23:55 2019
@@ -71,26 +71,31 @@ import org.eclipse.jdt.internal.core.Jav
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jface.preference.IPreferenceStore;
+
/**
* This document implementation is based on an uima cas object.
*/
public class DocumentUimaImpl extends AbstractDocument {
+ /** The Constant JAVA_NATURE. */
public static final String JAVA_NATURE = "org.eclipse.jdt.core.javanature";
+ /** The m CAS. */
private CAS mCAS;
+ /** The format. */
private SerialFormat format = SerialFormat.XMI;
+ /** The type system text. */
private final String typeSystemText;
/**
* Initializes a new instance.
- *
- * @param cas
- * @param casFile
- * @param typeSystemText
- * type system string
+ *
+ * @param cas the cas
+ * @param casFile the cas file
+ * @param typeSystemText type system string
+ * @throws CoreException the core exception
*/
public DocumentUimaImpl(CAS cas, IFile casFile, String typeSystemText) throws CoreException {
mCAS = cas;
@@ -102,7 +107,10 @@ public class DocumentUimaImpl extends Ab
/**
* Retrieves the {@link CAS}.
+ *
+ * @return the cas
*/
+ @Override
public CAS getCAS() {
return mCAS;
}
@@ -114,8 +122,8 @@ public class DocumentUimaImpl extends Ab
/**
* Internally removes an annotation from the {@link CAS}.
- *
- * @param featureStructure
+ *
+ * @param featureStructure the feature structure
*/
private void addFeatureStructureInternal(FeatureStructure featureStructure) {
getCAS().getIndexRepository().addFS(featureStructure);
@@ -123,13 +131,17 @@ public class DocumentUimaImpl extends Ab
/**
* Adds the given annotation to the {@link CAS}.
+ *
+ * @param annotation the annotation
*/
+ @Override
public void addFeatureStructure(FeatureStructure annotation) {
addFeatureStructureInternal(annotation);
fireAddedFeatureStructure(annotation);
}
+ @Override
public void addFeatureStructures(Collection<? extends FeatureStructure> annotations) {
for (FeatureStructure annotation : annotations) {
addFeatureStructureInternal(annotation);
@@ -142,8 +154,8 @@ public class DocumentUimaImpl extends Ab
/**
* Internally removes an annotation from the {@link CAS}.
- *
- * @param featureStructure
+ *
+ * @param featureStructure the feature structure
*/
private void removeAnnotationInternal(FeatureStructure featureStructure) {
getCAS().getIndexRepository().removeFS(featureStructure);
@@ -151,7 +163,10 @@ public class DocumentUimaImpl extends Ab
/**
* Removes the annotations from the {@link CAS}.
+ *
+ * @param annotation the annotation
*/
+ @Override
public void removeFeatureStructure(FeatureStructure annotation) {
removeAnnotationInternal(annotation);
@@ -160,7 +175,10 @@ public class DocumentUimaImpl extends Ab
/**
* Removes the given annotations from the {@link CAS}.
+ *
+ * @param annotationsToRemove the annotations to remove
*/
+ @Override
public void removeFeatureStructures(Collection<? extends FeatureStructure> annotationsToRemove) {
for (FeatureStructure annotationToRemove : annotationsToRemove) {
@@ -174,25 +192,36 @@ public class DocumentUimaImpl extends Ab
/**
* Notifies clients about the changed annotation.
+ *
+ * @param annotation the annotation
*/
+ @Override
public void update(FeatureStructure annotation) {
fireUpdatedFeatureStructure(annotation);
}
/**
* Notifies clients about the changed annotation.
+ *
+ * @param annotations the annotations
*/
+ @Override
public void updateFeatureStructure(Collection<? extends FeatureStructure> annotations) {
fireUpdatedFeatureStructure(annotations);
}
+ @Override
public void changed() {
fireChanged();
}
/**
* Retrieves annotations of the given type from the {@link CAS}.
+ *
+ * @param type the type
+ * @return the annotations
*/
+ @Override
public Collection<AnnotationFS> getAnnotations(Type type) {
FSIndex<AnnotationFS> annotationIndex = mCAS.getAnnotationIndex(type);
@@ -204,10 +233,16 @@ public class DocumentUimaImpl extends Ab
return fsIteratorToCollection(strictTypeIterator);
}
+ /**
+ * Fs iterator to collection.
+ *
+ * @param iterator the iterator
+ * @return the collection
+ */
static Collection<AnnotationFS> fsIteratorToCollection(FSIterator<AnnotationFS> iterator) {
- LinkedList<AnnotationFS> annotations = new LinkedList<AnnotationFS>();
+ LinkedList<AnnotationFS> annotations = new LinkedList<>();
while (iterator.hasNext()) {
- AnnotationFS annotation = (AnnotationFS) iterator.next();
+ AnnotationFS annotation = iterator.next();
annotations.addFirst(annotation);
}
@@ -217,11 +252,16 @@ public class DocumentUimaImpl extends Ab
/**
* Retrieves the given type from the {@link TypeSystem}.
+ *
+ * @param type the type
+ * @return the type
*/
+ @Override
public Type getType(String type) {
return getCAS().getTypeSystem().getType(type);
}
+ @Override
public void switchView(String viewName) {
String oldViewName = mCAS.getViewName();
@@ -232,6 +272,9 @@ public class DocumentUimaImpl extends Ab
/**
* Sets the content. The XCAS {@link InputStream} gets parsed.
+ *
+ * @param casFile the new content
+ * @throws CoreException the core exception
*/
private void setContent(IFile casFile) throws CoreException {
@@ -252,6 +295,12 @@ public class DocumentUimaImpl extends Ab
}
+ /**
+ * Throw core exception.
+ *
+ * @param e the e
+ * @throws CoreException the core exception
+ */
private void throwCoreException(Exception e) throws CoreException {
String message = e.getMessage() != null ? e.getMessage() : "";
IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e);
@@ -260,6 +309,9 @@ public class DocumentUimaImpl extends Ab
/**
* Serializes the {@link CAS} to the given {@link OutputStream} in the XCAS format.
+ *
+ * @param out the out
+ * @throws CoreException the core exception
*/
public void serialize(OutputStream out) throws CoreException {
try {
@@ -269,11 +321,16 @@ public class DocumentUimaImpl extends Ab
}
}
- public static CAS getVirginCAS(IFile typeSystemFile) throws CoreException {
+ /**
+ * Gets the virgin CAS.
+ *
+ * @param extensionTypeSystemFile the type system file
+ * @return the virgin CAS
+ * @throws CoreException the core exception
+ */
+ public static CAS getVirginCAS(IFile extensionTypeSystemFile) throws CoreException {
ResourceSpecifierFactory resourceSpecifierFactory = UIMAFramework.getResourceSpecifierFactory();
- IFile extensionTypeSystemFile = typeSystemFile;
-
InputStream inTypeSystem;
if (extensionTypeSystemFile != null && extensionTypeSystemFile.exists()) {
@@ -292,10 +349,10 @@ public class DocumentUimaImpl extends Ab
try {
typeSystemDesciptor = (TypeSystemDescription) xmlParser.parse(xmlTypeSystemSource);
- IProject project = typeSystemFile.getProject();
+ IProject project = extensionTypeSystemFile.getProject();
ClassLoader classLoader = getProjectClassLoader(project);
- ResourceManager resourceManager = null;
+ ResourceManager resourceManager;
if(classLoader != null) {
resourceManager = new ResourceManager_impl(classLoader);
} else {
@@ -308,11 +365,7 @@ public class DocumentUimaImpl extends Ab
resourceManager.setDataPath(dataPath);
}
typeSystemDesciptor.resolveImports(resourceManager);
- } catch (InvalidXMLException e) {
- String message = e.getMessage() != null ? e.getMessage() : "";
- IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e);
- throw new CoreException(s);
- } catch (MalformedURLException e) {
+ } catch (InvalidXMLException | MalformedURLException e) {
String message = e.getMessage() != null ? e.getMessage() : "";
IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e);
throw new CoreException(s);
@@ -338,6 +391,13 @@ public class DocumentUimaImpl extends Ab
return cas;
}
+ /**
+ * Gets the project class loader.
+ *
+ * @param project the project
+ * @return the project class loader
+ * @throws CoreException the core exception
+ */
public static ClassLoader getProjectClassLoader(IProject project) throws CoreException {
IProjectNature javaNature = project.getNature(JAVA_NATURE);
if (javaNature != null) {
@@ -345,8 +405,7 @@ public class DocumentUimaImpl extends Ab
String[] runtimeClassPath = JavaRuntime.computeDefaultRuntimeClassPath(javaProject);
List<URL> urls = new ArrayList<>();
- for (int i = 0; i < runtimeClassPath.length; i++) {
- String cp = runtimeClassPath[i];
+ for (String cp : runtimeClassPath) {
try {
urls.add(Paths.get(cp).toUri().toURL());
} catch (MalformedURLException e) {
@@ -357,5 +416,4 @@ public class DocumentUimaImpl extends Ab
}
return null;
}
-
}
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FeatureStructureSelection.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FeatureStructureSelection.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FeatureStructureSelection.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FeatureStructureSelection.java Mon Jul 22 12:23:55 2019
@@ -30,17 +30,23 @@ import org.eclipse.jface.viewers.IStruct
import org.eclipse.jface.viewers.StructuredSelection;
+
+/**
+ * The Class FeatureStructureSelection.
+ */
public class FeatureStructureSelection {
+
+ /** The m feature structures. */
private List<FeatureStructure> mFeatureStructures;
/**
* Initializes a the current instance with all FeatureStructure object that are contained in the
* {@link StructuredSelection}.
*
- * @param selection
+ * @param selection the selection
*/
public FeatureStructureSelection(IStructuredSelection selection) {
- mFeatureStructures = new ArrayList<FeatureStructure>(selection.size());
+ mFeatureStructures = new ArrayList<>(selection.size());
for (Object item : selection.toList()) {
FeatureStructure annotation = (FeatureStructure) Platform.getAdapterManager().getAdapter(
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FeatureStructureSelectionIterator.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FeatureStructureSelectionIterator.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FeatureStructureSelectionIterator.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FeatureStructureSelectionIterator.java Mon Jul 22 12:23:55 2019
@@ -27,19 +27,22 @@ import org.apache.uima.cas.text.Annotati
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.IStructuredSelection;
+
/**
* Iterates over all selected {@link FeatureStructure}s.
*/
public class FeatureStructureSelectionIterator implements Iterator<FeatureStructure> {
+ /** The m selection iterator. */
private Iterator<?> mSelectionIterator;
+ /** The m next. */
private FeatureStructure mNext;
/**
* Initializes the current instance.
*
- * @param selection
+ * @param selection the selection
*/
public FeatureStructureSelectionIterator(IStructuredSelection selection) {
mSelectionIterator = selection.iterator();
@@ -50,6 +53,7 @@ public class FeatureStructureSelectionIt
*
* @return true if there is one more element.
*/
+ @Override
public boolean hasNext() {
while (mSelectionIterator.hasNext() && mNext == null) {
Object item = mSelectionIterator.next();
@@ -67,6 +71,7 @@ public class FeatureStructureSelectionIt
*
* @return the next element.
*/
+ @Override
public FeatureStructure next() {
if (!hasNext()) {
throw new NoSuchElementException();
@@ -83,6 +88,7 @@ public class FeatureStructureSelectionIt
*
* @throws UnsupportedOperationException -
*/
+ @Override
public void remove() {
throw new UnsupportedOperationException();
}
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FeatureStructureSelectionProvider.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FeatureStructureSelectionProvider.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FeatureStructureSelectionProvider.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FeatureStructureSelectionProvider.java Mon Jul 22 12:23:55 2019
@@ -33,21 +33,25 @@ import org.eclipse.jface.viewers.IStruct
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
+
/**
* This class is a {@link ISelectionProvider} and informs its listeners about the currently selected
* {@link FeatureStructure}s.
*/
class FeatureStructureSelectionProvider implements ISelectionProvider {
+ /** The m current selection. */
private IStructuredSelection mCurrentSelection = new StructuredSelection();
- private Set<ISelectionChangedListener> mListeners = new HashSet<ISelectionChangedListener>();
+ /** The m listeners. */
+ private Set<ISelectionChangedListener> mListeners = new HashSet<>();
/**
* Adds an {@link ISelectionChangedListener} to this provider.
*
- * @param listener
+ * @param listener the listener
*/
+ @Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
Assert.isNotNull(listener);
@@ -59,6 +63,7 @@ class FeatureStructureSelectionProvider
*
* @return selection
*/
+ @Override
public ISelection getSelection() {
return mCurrentSelection;
}
@@ -69,6 +74,7 @@ class FeatureStructureSelectionProvider
* @param listener
* the listener to remove
*/
+ @Override
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
mListeners.remove(listener);
}
@@ -76,14 +82,13 @@ class FeatureStructureSelectionProvider
/**
* Sets the current selection.
*
- * @param selection
+ * @param selection the new selection
*/
+ @Override
public void setSelection(ISelection selection) {
Assert.isNotNull(selection);
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
-
- mCurrentSelection = structuredSelection;
+ mCurrentSelection = (IStructuredSelection) selection;
for (ISelectionChangedListener listener : mListeners) {
SelectionChangedEvent event = new SelectionChangedEvent(this, mCurrentSelection);
@@ -95,7 +100,8 @@ class FeatureStructureSelectionProvider
/**
* Sets the current selection to the given {@link AnnotationFS} object.
*
- * @param annotation
+ * @param document the document
+ * @param annotation the annotation
*/
public void setSelection(ICasDocument document, AnnotationFS annotation) {
if (annotation == null) {
@@ -105,6 +111,12 @@ class FeatureStructureSelectionProvider
setSelection(new StructuredSelection(new ModelFeatureStructure(document, annotation)));
}
+ /**
+ * Sets the selection.
+ *
+ * @param document the document
+ * @param selection the selection
+ */
public void setSelection(ICasDocument document, List<AnnotationFS> selection) {
setSelection(new StructuredSelection(ModelFeatureStructure.create(document, selection)));
}
@@ -125,4 +137,4 @@ class FeatureStructureSelectionProvider
public void clearSelectionSilently() {
mCurrentSelection = new StructuredSelection();
}
-}
\ No newline at end of file
+}
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FeatureValue.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FeatureValue.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FeatureValue.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FeatureValue.java Mon Jul 22 12:23:55 2019
@@ -27,17 +27,24 @@ import org.apache.uima.caseditor.editor.
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * The Class FeatureValue.
+ */
public final class FeatureValue implements IAdaptable {
+
+ /** The m structure. */
private FeatureStructure mStructure;
+ /** The m feature. */
private Feature mFeature;
/**
* Initializes a new instance.
*
- * @param document
- * @param structure
- * @param feature
+ * @param document the document
+ * @param structure the structure
+ * @param feature the feature
*/
public FeatureValue(ICasDocument document, FeatureStructure structure, Feature feature) {
Assert.isNotNull(document);
@@ -50,10 +57,20 @@ public final class FeatureValue implemen
mStructure = structure;
}
+ /**
+ * Gets the feature structure.
+ *
+ * @return the feature structure
+ */
public FeatureStructure getFeatureStructure() {
return mStructure;
}
+ /**
+ * Gets the value.
+ *
+ * @return the value
+ */
public Object getValue() {
if (mFeature.getRange().isPrimitive()) {
return Primitives.getPrimitive(mStructure, mFeature);
@@ -62,6 +79,7 @@ public final class FeatureValue implemen
return mStructure.getFeatureValue(mFeature);
}
+ @Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
if (AnnotationFS.class.equals(adapter)) {
if (getValue() instanceof AnnotationFS) {
@@ -84,7 +102,7 @@ public final class FeatureValue implemen
if (this == object) {
result = true;
- } else if (object != null && object instanceof FeatureValue) {
+ } else if (object instanceof FeatureValue) {
FeatureValue valueToCompare = (FeatureValue) object;
result = valueToCompare.mStructure.equals(mStructure)
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FindAnnotateAction.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FindAnnotateAction.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FindAnnotateAction.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FindAnnotateAction.java Mon Jul 22 12:23:55 2019
@@ -23,6 +23,7 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.text.IFindReplaceTarget;
import org.eclipse.swt.widgets.Display;
+
/**
* An Action to open the Find/Annotate Dialog.
*
@@ -30,9 +31,18 @@ import org.eclipse.swt.widgets.Display;
*/
public class FindAnnotateAction extends Action {
+ /** The editor. */
private AnnotationEditor editor;
+
+ /** The target. */
private IFindReplaceTarget target;
+ /**
+ * Instantiates a new find annotate action.
+ *
+ * @param editor the editor
+ * @param target the target
+ */
FindAnnotateAction(AnnotationEditor editor, IFindReplaceTarget target) {
this.editor = editor;
this.target = target;
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FindAnnotateDialog.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FindAnnotateDialog.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FindAnnotateDialog.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/FindAnnotateDialog.java Mon Jul 22 12:23:55 2019
@@ -46,6 +46,7 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
+
/**
* A dialog to find and annotate a piece of text in the document.
*
@@ -58,24 +59,49 @@ import org.eclipse.swt.widgets.Shell;
*/
class FindAnnotateDialog extends Dialog {
+ /** The Constant FIND_BUTTON. */
private static final int FIND_BUTTON = 100;
+
+ /** The Constant ANNOTATE_FIND_BUTTON. */
private static final int ANNOTATE_FIND_BUTTON = 101;
+
+ /** The Constant ANNOTATE_BUTTON. */
private static final int ANNOTATE_BUTTON = 102;
+
+ /** The Constant ANNOTATE_ALL_BUTTON. */
private static final int ANNOTATE_ALL_BUTTON = 103;
+
+ /** The close button. */
private static int CLOSE_BUTTON = 104;
+ /** The find replace target. */
private final IFindReplaceTarget findReplaceTarget;
+
+ /** The document. */
private final ICasDocument document;
+
+ /** The mode type. */
private final Type modeType;
+ /** The find field. */
private Combo findField;
+
+ /** The type field. */
private TypeCombo typeField;
+ /** The wide left side button. */
private Button wideLeftSideButton;
+
+ /** The lower left side button. */
private Button lowerLeftSideButton;
+
+ /** The lower right side button. */
private Button lowerRightSideButton;
+
+ /** The wide right side button. */
private Button wideRightSideButton;
+ /** The forward radio button. */
private Button forwardRadioButton;
/**
@@ -85,6 +111,14 @@ class FindAnnotateDialog extends Dialog
*/
private AnnotationFS currentAnnotation;
+ /**
+ * Instantiates a new find annotate dialog.
+ *
+ * @param parentShell the parent shell
+ * @param document the document
+ * @param findReplaceTarget the find replace target
+ * @param modeType the mode type
+ */
FindAnnotateDialog(Shell parentShell, ICasDocument document, IFindReplaceTarget findReplaceTarget, Type modeType) {
super(parentShell);
this.document = document;
@@ -106,10 +140,9 @@ class FindAnnotateDialog extends Dialog
/**
* Creates the search string input field.
- *
- * @param parent
- *
- * @return
+ *
+ * @param parent the parent
+ * @return the composite
*/
private Composite createInputPanel(Composite parent) {
Composite panel= new Composite(parent, SWT.NULL);
@@ -155,10 +188,9 @@ class FindAnnotateDialog extends Dialog
/**
* Creates the group to specify the direction of the search.
- *
- * @param parent
- *
- * @return
+ *
+ * @param parent the parent
+ * @return the composite
*/
private Composite createDirectionGroup(Composite parent) {
Composite panel = new Composite(parent, SWT.NONE);
@@ -184,6 +216,11 @@ class FindAnnotateDialog extends Dialog
return panel;
}
+ /**
+ * Creates the annotation buttons.
+ *
+ * @param parent the parent
+ */
private void createAnnotationButtons(Composite parent) {
Composite panel = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
@@ -204,10 +241,12 @@ class FindAnnotateDialog extends Dialog
wideLeftSideButton.setEnabled(false);
wideLeftSideButton.addSelectionListener(new SelectionListener(){
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
// never called, do not implement
}
+ @Override
public void widgetSelected(SelectionEvent e) {
WideLeftAnnotationSideAction.wideLeftAnnotationSide(document, currentAnnotation);
}
@@ -218,10 +257,12 @@ class FindAnnotateDialog extends Dialog
Images.LOWER_LEFT_SIDE).createImage());
lowerLeftSideButton.setEnabled(false);
lowerLeftSideButton.addSelectionListener(new SelectionListener(){
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
// never called, do not implement
}
+ @Override
public void widgetSelected(SelectionEvent e) {
LowerLeftAnnotationSideAction.lowerLeftAnnotationSide(document, currentAnnotation);
}
@@ -232,10 +273,12 @@ class FindAnnotateDialog extends Dialog
Images.LOWER_RIGHT_SIDE).createImage());
lowerRightSideButton.setEnabled(false);
lowerRightSideButton.addSelectionListener(new SelectionListener(){
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
// never called, do not implement
}
+ @Override
public void widgetSelected(SelectionEvent e) {
LowerRightAnnotationSideAction.lowerRightAnnotationSide(document, currentAnnotation);
}
@@ -246,16 +289,21 @@ class FindAnnotateDialog extends Dialog
Images.WIDE_RIGHT_SIDE).createImage());
wideRightSideButton.setEnabled(false);
wideRightSideButton.addSelectionListener(new SelectionListener(){
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
// never called, do not implement
}
+ @Override
public void widgetSelected(SelectionEvent e) {
WideRightAnnotationSideAction.wideRightAnnotationSide(document, currentAnnotation);
}
});
}
+ /**
+ * Update annotation buttons.
+ */
private void updateAnnotationButtons() {
boolean areButtonsEnabled = currentAnnotation != null;
@@ -267,10 +315,9 @@ class FindAnnotateDialog extends Dialog
/**
* Creates the find and annotate buttons.
- *
- * @param parent
- *
- * @return
+ *
+ * @param parent the parent
+ * @return the composite
*/
private Composite createButtonSection(Composite parent) {
Composite panel = new Composite(parent, SWT.NONE);
@@ -295,6 +342,12 @@ class FindAnnotateDialog extends Dialog
return panel;
}
+ /**
+ * Creates the status and close button.
+ *
+ * @param parent the parent
+ * @return the composite
+ */
private Composite createStatusAndCloseButton(Composite parent) {
Composite panel= new Composite(parent, SWT.NULL);
@@ -365,7 +418,7 @@ class FindAnnotateDialog extends Dialog
boolean isForwardSearch = forwardRadioButton.getSelection();
- int textOffset = -1;
+ int textOffset;
if (isForwardSearch) {
textOffset = findReplaceTarget.getSelection().x + findReplaceTarget.getSelection().y;
@@ -381,6 +434,11 @@ class FindAnnotateDialog extends Dialog
}
}
+ /**
+ * Annotate selection.
+ *
+ * @return the annotation FS
+ */
private AnnotationFS annotateSelection() {
Point selection = findReplaceTarget.getSelection();
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/IAnnotationEditorModifyListener.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/IAnnotationEditorModifyListener.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/IAnnotationEditorModifyListener.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/IAnnotationEditorModifyListener.java Mon Jul 22 12:23:55 2019
@@ -23,19 +23,29 @@ import java.util.Collection;
import org.apache.uima.cas.Type;
+
+/**
+ * The listener interface for receiving IAnnotationEditorModify events.
+ * The class that is interested in processing a IAnnotationEditorModify
+ * event implements this interface, and the object created
+ * with that class is registered with a component using the
+ * component's <code>addIAnnotationEditorModifyListener</code> method. When
+ * the IAnnotationEditorModify event occurs, that object's appropriate
+ * method is invoked.
+ */
public interface IAnnotationEditorModifyListener {
/**
* Called when the editor annotation mode changed.
*
- * @param newMode
+ * @param newMode the new mode
*/
- public void annotationModeChanged(Type newMode);
+ void annotationModeChanged(Type newMode);
/**
* Called when the shown annotation types in the editor are changed.
- *
- * @param shownAnnotationTypes
+ *
+ * @param shownAnnotationTypes the shown annotation types
*/
- public void showAnnotationsChanged(Collection<Type> shownAnnotationTypes);
+ void showAnnotationsChanged(Collection<Type> shownAnnotationTypes);
}
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/IAnnotationStyleListener.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/IAnnotationStyleListener.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/IAnnotationStyleListener.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/IAnnotationStyleListener.java Mon Jul 22 12:23:55 2019
@@ -21,6 +21,22 @@ package org.apache.uima.caseditor.editor
import java.util.Collection;
+
+/**
+ * The listener interface for receiving IAnnotationStyle events.
+ * The class that is interested in processing a IAnnotationStyle
+ * event implements this interface, and the object created
+ * with that class is registered with a component using the
+ * component's <code>addIAnnotationStyleListener</code> method. When
+ * the IAnnotationStyle event occurs, that object's appropriate
+ * method is invoked.
+ */
public interface IAnnotationStyleListener {
+
+ /**
+ * Annotation styles changed.
+ *
+ * @param styles the styles
+ */
void annotationStylesChanged(Collection<AnnotationStyle> styles);
}
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICasDocument.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICasDocument.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICasDocument.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICasDocument.java Mon Jul 22 12:23:55 2019
@@ -26,6 +26,7 @@ import org.apache.uima.cas.FeatureStruct
import org.apache.uima.cas.Type;
import org.apache.uima.cas.text.AnnotationFS;
+
/**
* The {@link ICasDocument} represents texts with meta information.
*
@@ -41,15 +42,15 @@ public interface ICasDocument {
/**
* Adds a given change listener.
- *
- * @param listener
+ *
+ * @param listener the listener
*/
void addChangeListener(ICasDocumentListener listener);
/**
* Removes the given change listener.
- *
- * @param listener
+ *
+ * @param listener the listener
*/
void removeChangeListener(ICasDocumentListener listener);
@@ -70,8 +71,8 @@ public interface ICasDocument {
/**
* Adds the {@link FeatureStructure}s.
- *
- * @param structures
+ *
+ * @param structures the structures
*/
void addFeatureStructures(Collection<? extends FeatureStructure> structures);
@@ -85,22 +86,22 @@ public interface ICasDocument {
/**
* Removes the given {@link FeatureStructure}s.
- *
- * @param structuresToRemove
+ *
+ * @param structuresToRemove the structures to remove
*/
void removeFeatureStructures(Collection<? extends FeatureStructure> structuresToRemove);
/**
* Updates the given {@link FeatureStructure}.
- *
- * @param structure
+ *
+ * @param structure the structure
*/
void update(FeatureStructure structure);
/**
* Updates the given {@link FeatureStructure}s.
- *
- * @param structures
+ *
+ * @param structures the structures
*/
void updateFeatureStructure(Collection<? extends FeatureStructure> structures);
@@ -121,22 +122,22 @@ public interface ICasDocument {
/**
* Switches the view of the underlying CAS to the provided view name.
- *
- * @param viewName
+ *
+ * @param viewName the view name
*/
void switchView(String viewName);
/**
* Retrieves the requested type.
- *
- * @param type
+ *
+ * @param type the type
* @return the type
*/
Type getType(String type);
/**
- * Retrieves the string representation of the applied type system
- *
+ * Retrieves the string representation of the applied type system.
+ *
* @return the string representation of the applied type system
*/
String getTypeSystemText();
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICasDocumentListener.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICasDocumentListener.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICasDocumentListener.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICasDocumentListener.java Mon Jul 22 12:23:55 2019
@@ -23,6 +23,7 @@ import java.util.Collection;
import org.apache.uima.cas.FeatureStructure;
+
/**
* This interface is used to notifies clients about {@link FeatureStructure} changes.
*/
@@ -61,15 +62,15 @@ public interface ICasDocumentListener {
/**
* This method is called if the {@link FeatureStructure} changed.
- *
- * @param featureStructure
+ *
+ * @param featureStructure the feature structure
*/
void updated(FeatureStructure featureStructure);
/**
* This method is called if the {@link FeatureStructure}s changed.
- *
- * @param featureStructure
+ *
+ * @param featureStructure the feature structure
*/
void updated(Collection<FeatureStructure> featureStructure);
@@ -84,9 +85,9 @@ public interface ICasDocumentListener {
* This method is called when the currently active view is changed in the document. A view changed
* does not indicate a structural change, but usually feature structures must be completely
* synchronized afterward.
- *
- * @param oldViewName
- * @param newViewName
+ *
+ * @param oldViewName the old view name
+ * @param newViewName the new view name
*/
void viewChanged(String oldViewName, String newViewName);
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICasEditor.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICasEditor.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICasEditor.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICasEditor.java Mon Jul 22 12:23:55 2019
@@ -22,6 +22,7 @@ package org.apache.uima.caseditor.editor
import org.apache.uima.cas.CAS;
import org.eclipse.ui.IEditorPart;
+
/**
* A Cas Editor is an extension to the {@link IEditorPart} interface and
* is responsible to view and edit a {@link CAS} object.
@@ -31,14 +32,37 @@ public interface ICasEditor extends IEdi
// TODO: Add a method to get the document provider, could needed
// by various views to store configuration linked to the ts!
+ /**
+ * Gets the document.
+ *
+ * @return the document
+ */
ICasDocument getDocument();
+ /**
+ * Gets the cas document provider.
+ *
+ * @return the cas document provider
+ */
CasDocumentProvider getCasDocumentProvider();
+ /**
+ * Reopen editor with new type system.
+ */
void reopenEditorWithNewTypeSystem();
+ /**
+ * Adds the cas editor input listener.
+ *
+ * @param listener the listener
+ */
void addCasEditorInputListener(ICasEditorInputListener listener);
+ /**
+ * Removes the cas editor input listener.
+ *
+ * @param listener the listener
+ */
void removeCasEditorInputListener(ICasEditorInputListener listener);
}
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICasEditorInputListener.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICasEditorInputListener.java?rev=1863543&r1=1863542&r2=1863543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICasEditorInputListener.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICasEditorInputListener.java Mon Jul 22 12:23:55 2019
@@ -21,6 +21,16 @@ package org.apache.uima.caseditor.editor
import org.eclipse.ui.IEditorInput;
+
+/**
+ * The listener interface for receiving ICasEditorInput events.
+ * The class that is interested in processing a ICasEditorInput
+ * event implements this interface, and the object created
+ * with that class is registered with a component using the
+ * component's <code>addICasEditorInputListener</code> method. When
+ * the ICasEditorInput event occurs, that object's appropriate
+ * method is invoked.
+ */
public interface ICasEditorInputListener {
/**
@@ -28,11 +38,11 @@ public interface ICasEditorInputListener
* The arguments of this methods can be null under certain circumstances.
* For example, if a document is opened where the type system cannot be found
* for, then the new document will be null.
- *
- * @param oldDocument
- * - the replaced, old document {@link ICasDocument}.
- * @param newDocument
- * - the new, current document {@link ICasDocument}.
+ *
+ * @param oldInput the old input
+ * @param oldDocument - the replaced, old document {@link ICasDocument}.
+ * @param newInput the new input
+ * @param newDocument - the new, current document {@link ICasDocument}.
*/
void casDocumentChanged(IEditorInput oldInput, ICasDocument oldDocument, IEditorInput newInput, ICasDocument newDocument);