Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICustomInformationControlContentHandler.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICustomInformationControlContentHandler.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICustomInformationControlContentHandler.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ICustomInformationControlContentHandler.java Mon Jul 22 12:23:55 2019 @@ -19,12 +19,17 @@ package org.apache.uima.caseditor.editor; + +/** + * The Interface ICustomInformationControlContentHandler. + */ public interface ICustomInformationControlContentHandler { + /** * Sets the input object. * - * @param control - * @param input + * @param control the control + * @param input the input */ void setInput(CustomInformationControl control, Object input); } \ No newline at end of file
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/IEditorSelectionListener.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/IEditorSelectionListener.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/IEditorSelectionListener.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/IEditorSelectionListener.java Mon Jul 22 12:23:55 2019 @@ -19,6 +19,16 @@ package org.apache.uima.caseditor.editor; + +/** + * The listener interface for receiving IEditorSelection events. + * The class that is interested in processing a IEditorSelection + * event implements this interface, and the object created + * with that class is registered with a component using the + * component's <code>addIEditorSelectionListener</code> method. When + * the IEditorSelection event occurs, that object's appropriate + * method is invoked. + */ public interface IEditorSelectionListener { /** * Called after focus changed. Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ModelFeatureStructure.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ModelFeatureStructure.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ModelFeatureStructure.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/ModelFeatureStructure.java Mon Jul 22 12:23:55 2019 @@ -28,64 +28,107 @@ import org.apache.uima.cas.text.Annotati import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Platform; + /** * TODO: * set feature value to null * delete feature value structure - * create feature value structure + * create feature value structure. */ public class ModelFeatureStructure implements IAdaptable { + + /** The m document. */ private ICasDocument mDocument; + /** The m feature structre. */ private FeatureStructure mFeatureStructre; /** * Initializes a new instance. * - * @param document - * @param featureStructre + * @param document the document + * @param featureStructre the feature structre */ public ModelFeatureStructure(ICasDocument document, FeatureStructure featureStructre) { mDocument = document; mFeatureStructre = featureStructre; } + /** + * Gets the document. + * + * @return the document + */ public ICasDocument getDocument() { return mDocument; } + /** + * Gets the structre. + * + * @return the structre + */ public FeatureStructure getStructre() { return mFeatureStructre; } + /** + * Sets the feature null. + * + * @param feature the new feature null + */ public void setFeatureNull(Feature feature) { mFeatureStructre.setFeatureValue(feature, null); } + /** + * Delete feature value. + * + * @param feature the feature + */ public void deleteFeatureValue(Feature feature) { // get value and call remove } + /** + * Creates the feature value. + * + * @param feature the feature + */ public void createFeatureValue(Feature feature) { // create, add and link } + /** + * Creates the feature value array. + * + * @param feature the feature + * @param size the size + */ public void createFeatureValueArray(Feature feature, int size) { // create add and link } + /** + * Creates the. + * + * @param document the document + * @param annotations the annotations + * @return the list + */ public static List<ModelFeatureStructure> create(ICasDocument document, List<AnnotationFS> annotations) { - List<ModelFeatureStructure> structres = new ArrayList<ModelFeatureStructure>(annotations.size()); + List<ModelFeatureStructure> structures = new ArrayList<>(annotations.size()); for (AnnotationFS annotation : annotations) { - structres.add(new ModelFeatureStructure(document, annotation)); + structures.add(new ModelFeatureStructure(document, annotation)); } - return structres; + return structures; } + @Override public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { if (FeatureStructure.class.equals(adapter)) { return getStructre(); @@ -96,6 +139,9 @@ public class ModelFeatureStructure imple } } + /** + * Update. + */ public void update() { mDocument.update(mFeatureStructre); } Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/QuickTypeSelectionDialog.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/QuickTypeSelectionDialog.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/QuickTypeSelectionDialog.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/QuickTypeSelectionDialog.java Mon Jul 22 12:23:55 2019 @@ -61,24 +61,29 @@ import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; + /** * This is a lightweight popup dialog which creates an annotation of the chosen type. */ class QuickTypeSelectionDialog extends PopupDialog { + /** The editor. */ private final AnnotationEditor editor; + /** The filter text. */ private Text filterText; - private Map<Character, Type> shortcutTypeMap = new HashMap<Character, Type>(); + /** The shortcut type map. */ + private Map<Character, Type> shortcutTypeMap = new HashMap<>(); - private Map<Type, Character> typeShortcutMap = new HashMap<Type, Character>(); + /** The type shortcut map. */ + private Map<Type, Character> typeShortcutMap = new HashMap<>(); /** * Initializes the current instance. - * - * @param parent - * @param editor + * + * @param parent the parent + * @param editor the editor */ @SuppressWarnings("deprecation") QuickTypeSelectionDialog(Shell parent, AnnotationEditor editor) { @@ -91,15 +96,16 @@ class QuickTypeSelectionDialog extends P String shortcutsString = "qwertzuiopasdfghjklyxcvbnm1234567890"; - Set<Character> shortcuts = new HashSet<Character>(); + Set<Character> shortcuts = new HashSet<>(); for (int i = 0; i < shortcutsString.length(); i++) { shortcuts.add(shortcutsString.charAt(i)); } - List<Type> types = new ArrayList<Type>(); + List<Type> types = new ArrayList<>(); Collections.addAll(types, getTypes()); - Collections.sort(types, new Comparator<Type>() { + types.sort(new Comparator<Type>() { + @Override public int compare(Type o1, Type o2) { return o1.getName().compareTo(o2.getName()); } @@ -153,11 +159,22 @@ class QuickTypeSelectionDialog extends P } } + /** + * Put shortcut. + * + * @param shortcut the shortcut + * @param type the type + */ private void putShortcut(Character shortcut, Type type) { shortcutTypeMap.put(shortcut, type); typeShortcutMap.put(type, shortcut); } + /** + * Gets the types. + * + * @return the types + */ private Type[] getTypes() { TypeSystem typeSystem = editor.getDocument().getCAS().getTypeSystem(); @@ -170,6 +187,11 @@ class QuickTypeSelectionDialog extends P return types.toArray(new Type[types.size()]); } + /** + * Annotate and close. + * + * @param annotationType the annotation type + */ private void annotateAndClose(Type annotationType) { if (annotationType != null) { Point textSelection = editor.getSelection(); @@ -211,6 +233,7 @@ class QuickTypeSelectionDialog extends P filterText.addKeyListener(new KeyListener() { + @Override public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.ARROW_DOWN || e.keyCode == SWT.ARROW_UP) { typeTree.getControl().setFocus(); @@ -224,6 +247,7 @@ class QuickTypeSelectionDialog extends P } } + @Override public void keyReleased(KeyEvent e) { typeTree.refresh(false); } @@ -231,25 +255,31 @@ class QuickTypeSelectionDialog extends P typeTree.setContentProvider(new ITreeContentProvider() { + @Override public Object[] getChildren(Object parentElement) { return null; } + @Override public Object getParent(Object element) { return null; } + @Override public boolean hasChildren(Object element) { return false; } + @Override public Object[] getElements(Object inputElement) { return (Type[]) inputElement; } + @Override public void dispose() { } + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } }); @@ -267,10 +297,12 @@ class QuickTypeSelectionDialog extends P typeTree.setLabelProvider(new ILabelProvider() { + @Override public Image getImage(Object element) { return null; } + @Override public String getText(Object element) { Type type = (Type) element; @@ -284,23 +316,28 @@ class QuickTypeSelectionDialog extends P } } + @Override public void addListener(ILabelProviderListener listener) { } + @Override public void dispose() { } + @Override public boolean isLabelProperty(Object element, String property) { return false; } + @Override public void removeListener(ILabelProviderListener listener) { } }); typeTree.getControl().addKeyListener(new KeyListener() { + @Override public void keyPressed(KeyEvent e) { Type type = shortcutTypeMap.get(Character.toLowerCase(e.character)); @@ -309,12 +346,14 @@ class QuickTypeSelectionDialog extends P } } + @Override public void keyReleased(KeyEvent e) { } }); typeTree.getControl().addMouseMoveListener(new MouseMoveListener() { + @Override public void mouseMove(MouseEvent e) { Tree tree = (Tree) typeTree.getControl(); @@ -331,6 +370,7 @@ class QuickTypeSelectionDialog extends P // because there is already a selection below the mouse typeTree.addOpenListener(new IOpenListener() { + @Override public void open(OpenEvent event) { StructuredSelection selection = (StructuredSelection) event.getSelection(); Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/SubPageSite.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/SubPageSite.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/SubPageSite.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/SubPageSite.java Mon Jul 22 12:23:55 2019 @@ -28,54 +28,77 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.SubActionBars; import org.eclipse.ui.part.IPageSite; + +/** + * The Class SubPageSite. + */ public class SubPageSite implements IPageSite { + /** The site. */ private final IPageSite site; + /** The sub action bars. */ private SubActionBars subActionBars; + + /** The selection provider. */ private ISelectionProvider selectionProvider; + /** + * Instantiates a new sub page site. + * + * @param site the site + */ public SubPageSite(IPageSite site) { this.site = site; } + @Override public boolean hasService(@SuppressWarnings("rawtypes") Class api) { return site.hasService(api); } + @Override public Object getService(@SuppressWarnings("rawtypes") Class api) { return site.getService(api); } + @Override public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { return site.getAdapter(adapter); } + @Override public void setSelectionProvider(ISelectionProvider provider) { selectionProvider = provider; } + @Override public IWorkbenchWindow getWorkbenchWindow() { return site.getWorkbenchWindow(); } + @Override public Shell getShell() { return site.getShell(); } + @Override public ISelectionProvider getSelectionProvider() { return selectionProvider; } + @Override public IWorkbenchPage getPage() { return site.getPage(); } + @Override public void registerContextMenu(String menuId, MenuManager menuManager, ISelectionProvider selectionProvider) { site.registerContextMenu(menuId, menuManager, selectionProvider); } + @Override public IActionBars getActionBars() { if (subActionBars == null) { @@ -84,4 +107,4 @@ public class SubPageSite implements IPag return subActionBars; } -} \ No newline at end of file +} Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/TextDocumentProvider.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/TextDocumentProvider.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/TextDocumentProvider.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/TextDocumentProvider.java Mon Jul 22 12:23:55 2019 @@ -28,51 +28,76 @@ import org.eclipse.jface.text.source.IAn import org.eclipse.ui.texteditor.AbstractDocumentProvider; import org.eclipse.ui.texteditor.IElementStateListener; + +/** + * The Class TextDocumentProvider. + */ class TextDocumentProvider extends AbstractDocumentProvider { + /** + * The Class CasElementInfo. + */ private class CasElementInfo extends AbstractDocumentProvider.ElementInfo { + /** The cas info. */ private CasDocumentProvider.ElementInfo casInfo; + /** + * Instantiates a new cas element info. + * + * @param document the document + * @param model the model + */ public CasElementInfo(IDocument document, IAnnotationModel model) { super(document, model); } } + /** The document provider. */ private final CasDocumentProvider documentProvider; + /** + * Instantiates a new text document provider. + * + * @param documentProvider the document provider + */ public TextDocumentProvider(CasDocumentProvider documentProvider) { this.documentProvider = documentProvider; this.documentProvider.addElementStateListener(new IElementStateListener() { + @Override public void elementMoved(Object originalElement, Object movedElement) { fireElementMoved(originalElement, movedElement); } + @Override public void elementDirtyStateChanged(Object element, boolean isDirty) { fireElementDirtyStateChanged(element, isDirty); } + @Override public void elementDeleted(Object element) { fireElementDeleted(element); } + @Override public void elementContentReplaced(Object element) { fireElementContentReplaced(element); } + @Override public void elementContentAboutToBeReplaced(Object element) { fireElementContentAboutToBeReplaced(element); } }); } - + @Override - protected IAnnotationModel createAnnotationModel(Object element) throws CoreException { + protected IAnnotationModel createAnnotationModel(Object element) { return new org.eclipse.jface.text.source.AnnotationModel(); } - + @Override protected IDocument createDocument(Object element) throws CoreException { ICasDocument casDocument = documentProvider.createDocument(element); @@ -103,7 +128,7 @@ class TextDocumentProvider extends Abstr protected IRunnableContext getOperationRunner(IProgressMonitor monitor) { return null; } - + @Override protected ElementInfo createElementInfo(Object element) throws CoreException { @@ -113,7 +138,7 @@ class TextDocumentProvider extends Abstr return casElementInfo; } - + @Override protected void disposeElementInfo(Object element, ElementInfo info) { @@ -122,7 +147,7 @@ class TextDocumentProvider extends Abstr CasElementInfo casElementInfo = (CasElementInfo) info; documentProvider.disposeElementInfo(element, casElementInfo.casInfo); } - + @Override public IStatus getStatus(Object element) { IStatus status = documentProvider.getStatus(element); Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java Mon Jul 22 12:23:55 2019 @@ -25,16 +25,19 @@ import org.apache.uima.caseditor.editor. import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.actions.BaseSelectionListenerAction; + /** * Deletes all selected annotations. */ public class DeleteFeatureStructureAction extends BaseSelectionListenerAction { + + /** The editor. */ private ICasEditor editor; /** * Initializes the current instance. * - * @param editor + * @param editor the editor */ public DeleteFeatureStructureAction(ICasEditor editor) { super("DeleteAction"); @@ -63,4 +66,4 @@ public class DeleteFeatureStructureActio editor.getDocument().removeFeatureStructures(featureStructures.toList()); } -} \ No newline at end of file +} Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/LowerLeftAnnotationSideAction.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/LowerLeftAnnotationSideAction.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/LowerLeftAnnotationSideAction.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/LowerLeftAnnotationSideAction.java Mon Jul 22 12:23:55 2019 @@ -29,23 +29,25 @@ import org.apache.uima.caseditor.editor. import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.actions.BaseSelectionListenerAction; + /** * Lowers the left side of the currently selected annotation by one. */ public final class LowerLeftAnnotationSideAction extends BaseSelectionListenerAction { + /** The Constant ID. */ public static final String ID = "LowerLeftAnnotationSide"; + /** The editor. */ private ICasEditor editor; /** * Initializes a new instance. * - * @param editor - * + * @param editor the editor */ public LowerLeftAnnotationSideAction(ICasEditor editor) { - super("LowerLeftAnnotationSide"); + super(ID); this.editor = editor; @@ -59,6 +61,12 @@ public final class LowerLeftAnnotationSi return annotation.size() == 1; } + /** + * Lower left annotation side. + * + * @param document the document + * @param annotation the annotation + */ public static void lowerLeftAnnotationSide(ICasDocument document, AnnotationFS annotation) { Type annotationType = annotation.getType(); Feature beginFeature = annotationType.getFeatureByBaseName("begin"); Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/LowerRightAnnotationSideAction.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/LowerRightAnnotationSideAction.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/LowerRightAnnotationSideAction.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/LowerRightAnnotationSideAction.java Mon Jul 22 12:23:55 2019 @@ -29,22 +29,25 @@ import org.apache.uima.caseditor.editor. import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.actions.BaseSelectionListenerAction; + /** * Lowers the right side of the currently selected annotation by one. */ public final class LowerRightAnnotationSideAction extends BaseSelectionListenerAction { + /** The Constant ID. */ public static final String ID = "LowerRightAnnotationSide"; + /** The editor. */ private ICasEditor editor; /** * Initializes the current instance. * - * @param editor + * @param editor the editor */ public LowerRightAnnotationSideAction(ICasEditor editor) { - super("LowerRightAnnotationSide"); + super(ID); this.editor = editor; @@ -58,6 +61,12 @@ public final class LowerRightAnnotationS return annotation.size() == 1; } + /** + * Lower right annotation side. + * + * @param document the document + * @param annotation the annotation + */ public static void lowerRightAnnotationSide(ICasDocument document, AnnotationFS annotation) { Type annotationType = annotation.getType(); Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/MergeAnnotationAction.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/MergeAnnotationAction.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/MergeAnnotationAction.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/MergeAnnotationAction.java Mon Jul 22 12:23:55 2019 @@ -28,6 +28,7 @@ import org.apache.uima.caseditor.editor. import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.actions.BaseSelectionListenerAction; + /** * Merges two or more annotations. * @@ -35,12 +36,14 @@ import org.eclipse.ui.actions.BaseSelect * in conflict case do nothing */ public class MergeAnnotationAction extends BaseSelectionListenerAction { + + /** The editor. */ private ICasEditor editor; /** * Initializes the current instance. * - * @param editor + * @param editor the editor */ public MergeAnnotationAction(ICasEditor editor) { super("MergeAnnotationAction"); @@ -58,7 +61,7 @@ public class MergeAnnotationAction exten } /** - * Executes the merge action + * Executes the merge action. */ @Override public void run() { @@ -74,4 +77,4 @@ public class MergeAnnotationAction exten document.removeFeatureStructures(annotations.toList()); document.addFeatureStructure(mergedAnnotation); } -} \ No newline at end of file +} Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/WideLeftAnnotationSideAction.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/WideLeftAnnotationSideAction.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/WideLeftAnnotationSideAction.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/WideLeftAnnotationSideAction.java Mon Jul 22 12:23:55 2019 @@ -29,19 +29,22 @@ import org.apache.uima.caseditor.editor. import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.actions.BaseSelectionListenerAction; + /** * Widens the left side of the currently selected annotation by one. */ public final class WideLeftAnnotationSideAction extends BaseSelectionListenerAction { + /** The Constant ID. */ public static final String ID = "WideLeftAnnotationSide"; + /** The editor. */ private ICasEditor editor; /** * Initializes a new instance. * - * @param editor + * @param editor the editor */ public WideLeftAnnotationSideAction(ICasEditor editor) { super("WideLeftAnnotationSside"); @@ -61,9 +64,9 @@ public final class WideLeftAnnotationSid /** * Widens the annotation and sends and sends an update notification * to the provided document. - * - * @param document - * @param annotation + * + * @param document the document + * @param annotation the annotation */ public static void wideLeftAnnotationSide(ICasDocument document, AnnotationFS annotation) { Type annotationType = annotation.getType(); Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/WideRightAnnotationSideAction.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/WideRightAnnotationSideAction.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/WideRightAnnotationSideAction.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/action/WideRightAnnotationSideAction.java Mon Jul 22 12:23:55 2019 @@ -29,22 +29,25 @@ import org.apache.uima.caseditor.editor. import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.actions.BaseSelectionListenerAction; + /** * Widens the right side of the currently selected annotation by one. */ public final class WideRightAnnotationSideAction extends BaseSelectionListenerAction { + /** The Constant ID. */ public static final String ID = "WideRightAnnotationSide"; + /** The editor. */ private ICasEditor editor; /** * Initializes a new instance. * - * @param editor + * @param editor the editor */ public WideRightAnnotationSideAction(ICasEditor editor) { - super("WideRightAnnotationSide"); + super(ID); this.editor = editor; @@ -58,6 +61,12 @@ public final class WideRightAnnotationSi return annotation.size() == 1; } + /** + * Wide right annotation side. + * + * @param document the document + * @param annotation the annotation + */ public static void wideRightAnnotationSide(ICasDocument document, AnnotationFS annotation) { Type annotationType = annotation.getType(); Feature endFeature = annotationType.getFeatureByBaseName("end"); Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/BackgroundDrawingStrategy.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/BackgroundDrawingStrategy.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/BackgroundDrawingStrategy.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/BackgroundDrawingStrategy.java Mon Jul 22 12:23:55 2019 @@ -33,26 +33,28 @@ import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; + /** * Fills the background of an annotation. */ final class BackgroundDrawingStrategy implements IDrawingStrategy { + /** * Fill the background of the given annotation in the specified color. * - * @param annotation - * @param gc - * @param textWidget - * @param offset - * @param length - * @param color + * @param annotation the annotation + * @param gc the gc + * @param textWidget the text widget + * @param offset the offset + * @param length the length + * @param color the color */ - public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, + @Override + public void draw(Annotation annotation, GC gc, StyledText textWidget, int annotationBegin, int length, Color color) { if (length != 0) { if (gc != null) { - int annotationBegin = offset; - int annotationEnd = offset + length; + int annotationEnd = annotationBegin + length; Rectangle bounds = textWidget.getTextBounds(annotationBegin, annotationEnd - 1); @@ -70,12 +72,12 @@ final class BackgroundDrawingStrategy im // The z offsets should be drawn, the X offsets should not be overdrawn. That is solved // by drawing for every z offset area one background rectangle. - List<Span> dontOverDrawSpans = new ArrayList<Span>(); + List<Span> dontOverDrawSpans = new ArrayList<>(); - Span annotationSpan = new Span(offset, length); + Span annotationSpan = new Span(annotationBegin, length); // add all style ranges to the list in the range of the annotation - for (StyleRange styleRange : textWidget.getStyleRanges(offset, length)) { + for (StyleRange styleRange : textWidget.getStyleRanges(annotationBegin, length)) { Span styleRangeSpan = new Span(styleRange.start, styleRange.length); if (styleRangeSpan.getLength() > 0) dontOverDrawSpans.add(styleRangeSpan); @@ -96,7 +98,7 @@ final class BackgroundDrawingStrategy im gc.setBackground(color); if (dontOverDrawSpans.size() > 0) { - int zBegin = offset; + int zBegin = annotationBegin; for (Span xSpan : dontOverDrawSpans) { if (xSpan.getLength() > 0 && zBegin < xSpan.getStart()) { Rectangle selectionBounds = textWidget.getTextBounds(zBegin, xSpan.getStart() -1); @@ -118,13 +120,12 @@ final class BackgroundDrawingStrategy im gc.fillRectangle(selectionBounds); } - int start = offset; - int end = offset + length - 1; + int end = annotationBegin + length - 1; gc.setForeground(new Color(gc.getDevice(), 0, 0, 0)); // Instead of a tab draw textWidget.getTabs() spaces - String annotationText = textWidget.getText(start, end); + String annotationText = textWidget.getText(annotationBegin, end); if (annotationText.contains("\t")) { char replacementSpaces[] = new char[textWidget.getTabs()]; @@ -136,7 +137,7 @@ final class BackgroundDrawingStrategy im gc.drawText(annotationText, bounds.x, bounds.y, true); } else { - textWidget.redrawRange(offset, length, true); + textWidget.redrawRange(annotationBegin, length, true); } } } Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/BoxDrawingStrategy.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/BoxDrawingStrategy.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/BoxDrawingStrategy.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/BoxDrawingStrategy.java Mon Jul 22 12:23:55 2019 @@ -26,20 +26,23 @@ import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Rectangle; + /** * Draws a box around an annotation. */ final class BoxDrawingStrategy implements IDrawingStrategy { + /** * Draws a box around the given annotation. * - * @param annotation - * @param gc - * @param textWidget - * @param offset - * @param length - * @param color + * @param annotation the annotation + * @param gc the gc + * @param textWidget the text widget + * @param offset the offset + * @param length the length + * @param color the color */ + @Override public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, Color color) { if (length != 0) { @@ -70,4 +73,4 @@ final class BoxDrawingStrategy implement } } } -} \ No newline at end of file +} Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/BracketDrawingStrategy.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/BracketDrawingStrategy.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/BracketDrawingStrategy.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/BracketDrawingStrategy.java Mon Jul 22 12:23:55 2019 @@ -27,22 +27,26 @@ import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Rectangle; + /** - * Draws brackets arround an annotation. + * Draws brackets around an annotation. */ public class BracketDrawingStrategy implements IDrawingStrategy { + + /** The Constant BRACKET_WIDTH. */ private static final int BRACKET_WIDTH = 3; /** * Draws an opening bracket to the begin and a closing bracket to the end of the given annotation. * - * @param annotation - * @param gc - * @param textWidget - * @param offset - * @param length - * @param color + * @param annotation the annotation + * @param gc the gc + * @param textWidget the text widget + * @param offset the offset + * @param length the length + * @param color the color */ + @Override public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, Color color) { if (length > 0) { @@ -81,4 +85,4 @@ public class BracketDrawingStrategy impl } } } -} \ No newline at end of file +} Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java Mon Jul 22 12:23:55 2019 @@ -26,6 +26,7 @@ import org.apache.uima.caseditor.editor. import org.apache.uima.caseditor.editor.AnnotationStyle.Style; import org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy; + /** * A factory for drawing styles. * @@ -33,8 +34,9 @@ import org.eclipse.jface.text.source.Ann */ public class DrawingStyle { + /** The stateless styles. */ private static Map<AnnotationStyle.Style, IDrawingStrategy> statelessStyles = - new HashMap<AnnotationStyle.Style, IDrawingStrategy>(); + new HashMap<>(); static { statelessStyles.put(Style.BACKGROUND, new BackgroundDrawingStrategy()); @@ -48,12 +50,16 @@ public class DrawingStyle { statelessStyles.put(Style.BRACKET, new BracketDrawingStrategy()); } + /** + * Instantiates a new drawing style. + */ private DrawingStyle() { } /** * Retrieves the {@link IDrawingStrategy}. * + * @param style the style * @return the {@link IDrawingStrategy} or null if does not exist. */ public static IDrawingStrategy createStrategy(AnnotationStyle style) { @@ -66,4 +72,4 @@ public class DrawingStyle { return strategy; } -} \ No newline at end of file +} Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/EclipseAnnotationPeer.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/EclipseAnnotationPeer.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/EclipseAnnotationPeer.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/EclipseAnnotationPeer.java Mon Jul 22 12:23:55 2019 @@ -21,18 +21,20 @@ package org.apache.uima.caseditor.editor import org.apache.uima.cas.text.AnnotationFS; + /** * This class is used to provide additional information about the {@link AnnotationFS} * object to the custom drawing strategies. */ public class EclipseAnnotationPeer extends org.eclipse.jface.text.source.Annotation { + /** The annotation. */ private final AnnotationFS annotation; /** * Initializes a new instance. * - * @param annotation + * @param annotation the annotation */ public EclipseAnnotationPeer(AnnotationFS annotation) { super(annotation.getType().getName(), false, ""); @@ -49,11 +51,12 @@ public class EclipseAnnotationPeer exten return annotation; } + @Override public int hashCode() { return annotation.hashCode(); } - + @Override public boolean equals(Object obj) { if (obj == this) { @@ -68,7 +71,7 @@ public class EclipseAnnotationPeer exten return false; } } - + @Override public String toString() { return annotation.toString(); Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/TagDrawingStrategy.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/TagDrawingStrategy.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/TagDrawingStrategy.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/TagDrawingStrategy.java Mon Jul 22 12:23:55 2019 @@ -32,15 +32,27 @@ import org.eclipse.swt.graphics.Rectangl + // TODO: Check if its possible to increase the space between characters, +/** + * The Class TagDrawingStrategy. + */ // or suggest to use mono space font for long tags ... class TagDrawingStrategy implements IDrawingStrategy { + /** The Constant TAG_FONT_SIZE. */ private static final int TAG_FONT_SIZE = 11; + + /** The Constant MAX_LEFT_TAG_OVERLAP. */ private static final int MAX_LEFT_TAG_OVERLAP = 1; + + /** The Constant MAX_RIGHT_TAG_OVERLAP. */ private static final int MAX_RIGHT_TAG_OVERLAP = 1; + + /** The Constant TAG_OVERLAP. */ private static final int TAG_OVERLAP = MAX_LEFT_TAG_OVERLAP + MAX_RIGHT_TAG_OVERLAP; + /** The annotation drawing style. */ private IDrawingStrategy annotationDrawingStyle = new BoxDrawingStrategy(); /** @@ -48,6 +60,11 @@ class TagDrawingStrategy implements IDra */ private final String featureName; + /** + * Instantiates a new tag drawing strategy. + * + * @param featureName the feature name + */ TagDrawingStrategy(String featureName) { if (featureName == null) @@ -56,6 +73,7 @@ class TagDrawingStrategy implements IDra this.featureName = featureName; } + @Override public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, Color color) { Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/TextColorDrawingStrategy.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/TextColorDrawingStrategy.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/TextColorDrawingStrategy.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/TextColorDrawingStrategy.java Mon Jul 22 12:23:55 2019 @@ -26,17 +26,19 @@ import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Rectangle; + /** + * The Class TextColorDrawingStrategy. */ public class TextColorDrawingStrategy implements IDrawingStrategy { - public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, Color color) { + @Override + public void draw(Annotation annotation, GC gc, StyledText textWidget, int start, int length, Color color) { if (length > 0) { if (annotation instanceof EclipseAnnotationPeer) { if (gc != null) { - int start = offset; - int end = offset + length - 1; + int end = start + length - 1; Rectangle bounds = textWidget.getTextBounds(start, end); @@ -45,9 +47,9 @@ public class TextColorDrawingStrategy im gc.drawText(textWidget.getText(start, end), bounds.x, bounds.y, true); } else { - textWidget.redrawRange(offset, length, true); + textWidget.redrawRange(start, length, true); } } } } -} \ No newline at end of file +} Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/TokenDrawingStrategy.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/TokenDrawingStrategy.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/TokenDrawingStrategy.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/TokenDrawingStrategy.java Mon Jul 22 12:23:55 2019 @@ -27,16 +27,27 @@ import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Rectangle; + +/** + * The Class TokenDrawingStrategy. + */ public class TokenDrawingStrategy implements IDrawingStrategy { + + /** The Constant BRACKET_WIDTH. */ private static final int BRACKET_WIDTH = 5; + /** + * Checks if is whitespace. + * + * @param text the text + * @param offset the offset + * @return true, if is whitespace + */ private static boolean isWhitespace(String text, int offset) { - - char character = text.charAt(offset); - - return Character.isWhitespace(character); + return Character.isWhitespace(text.charAt(offset)); } + @Override public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, Color color) { if (length > 0) { @@ -77,4 +88,4 @@ public class TokenDrawingStrategy implem } } } -} \ No newline at end of file +} Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/UnderlineDrawingStrategy.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/UnderlineDrawingStrategy.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/UnderlineDrawingStrategy.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/annotation/UnderlineDrawingStrategy.java Mon Jul 22 12:23:55 2019 @@ -27,6 +27,7 @@ import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; + /** * Draws an line under an annotation. */ @@ -35,13 +36,14 @@ public class UnderlineDrawingStrategy im /** * Draws a line under under a given annotation. * - * @param annotation - * @param gc - * @param textWidget - * @param offset - * @param length - * @param color + * @param annotation the annotation + * @param gc the gc + * @param textWidget the text widget + * @param offset the offset + * @param length the length + * @param color the color */ + @Override public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, Color color) { if (gc != null) { Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/context/AnnotationEditingControl.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/context/AnnotationEditingControl.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/context/AnnotationEditingControl.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/context/AnnotationEditingControl.java Mon Jul 22 12:23:55 2019 @@ -25,15 +25,13 @@ import org.eclipse.swt.layout.FillLayout import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; -/** - * TODO: add javadoch here - */ + public class AnnotationEditingControl extends Composite { /** * Initializes the current instance. * - * @param parent + * @param parent the parent */ public AnnotationEditingControl(Composite parent) { super(parent, SWT.NONE); @@ -49,11 +47,8 @@ public class AnnotationEditingControl ex /** * Display this feature structure. * - * @param structure + * @param structure the structure */ public void displayFeatureStructure(FeatureStructure structure) { - - - } } Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/context/AnnotationEditingControlCreator.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/context/AnnotationEditingControlCreator.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/context/AnnotationEditingControlCreator.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/context/AnnotationEditingControlCreator.java Mon Jul 22 12:23:55 2019 @@ -27,21 +27,23 @@ import org.eclipse.jface.text.IInformati import org.eclipse.jface.text.IInformationControlCreator; import org.eclipse.swt.widgets.Shell; + /** - * TODO: add javadoc here + * TODO: add javadoc here. */ public class AnnotationEditingControlCreator implements IInformationControlCreator { /** * Creates the information control. * - * @param parent - * + * @param parent the parent * @return the new control */ + @Override public IInformationControl createInformationControl(Shell parent) { final ICustomInformationControlContentHandler contentHandler = new ICustomInformationControlContentHandler() { + @Override public void setInput(CustomInformationControl control, Object input) { AnnotationEditingControl annotationEditControl = (AnnotationEditingControl) control .getControl(); @@ -62,4 +64,4 @@ public class AnnotationEditingControlCre return control; } -} \ No newline at end of file +} Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/IModeMenuListener.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/IModeMenuListener.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/IModeMenuListener.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/IModeMenuListener.java Mon Jul 22 12:23:55 2019 @@ -21,12 +21,22 @@ package org.apache.uima.caseditor.editor import org.apache.uima.cas.Type; + +/** + * The listener interface for receiving IModeMenu events. + * The class that is interested in processing a IModeMenu + * event implements this interface, and the object created + * with that class is registered with a component using the + * component's <code>addIModeMenuListener</code> method. When + * the IModeMenu event occurs, that object's appropriate + * method is invoked. + */ public interface IModeMenuListener { /** * Mode was changed to a new mode. - * - * @param newMode + * + * @param newMode the new mode */ void modeChanged(Type newMode); } \ No newline at end of file Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/IShowAnnotationsListener.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/IShowAnnotationsListener.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/IShowAnnotationsListener.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/IShowAnnotationsListener.java Mon Jul 22 12:23:55 2019 @@ -23,6 +23,22 @@ import java.util.Collection; import org.apache.uima.cas.Type; + +/** + * The listener interface for receiving IShowAnnotations events. + * The class that is interested in processing a IShowAnnotations + * event implements this interface, and the object created + * with that class is registered with a component using the + * component's <code>addIShowAnnotationsListener</code> method. When + * the IShowAnnotations event occurs, that object's appropriate + * method is invoked. + */ public interface IShowAnnotationsListener { - void selectionChanged(Collection<Type> selection); + + /** + * Selection changed. + * + * @param selection the selection + */ + void selectionChanged(Collection<Type> selection); } \ No newline at end of file Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/ModeMenu.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/ModeMenu.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/ModeMenu.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/ModeMenu.java Mon Jul 22 12:23:55 2019 @@ -32,34 +32,47 @@ import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; + /** * Creates the mode context sub menu. */ public class ModeMenu extends TypeMenu { + /** The editor. */ private AnnotationEditor editor; - private Set<IModeMenuListener> listeners = new HashSet<IModeMenuListener>(); + /** The listeners. */ + private Set<IModeMenuListener> listeners = new HashSet<>(); /** * Initializes a new instance. * - * @param typeSystem - * @param editor + * @param typeSystem the type system + * @param editor the editor */ public ModeMenu(TypeSystem typeSystem, AnnotationEditor editor) { super(typeSystem.getType(CAS.TYPE_NAME_ANNOTATION), typeSystem); this.editor = editor; } + /** + * Adds the listener. + * + * @param listener the listener + */ public void addListener(IModeMenuListener listener) { listeners.add(listener); } + /** + * Removes the listener. + * + * @param listener the listener + */ public void removeListener(IModeMenuListener listener) { listeners.remove(listener); } - + @Override protected void insertAction(final Type type, Menu parentMenu) { MenuItem actionItem = new MenuItem(parentMenu, SWT.CHECK); @@ -69,6 +82,7 @@ public class ModeMenu extends TypeMenu { actionItem.setSelection(true); actionItem.addListener(SWT.Selection, new Listener() { + @Override public void handleEvent(Event e) { for (IModeMenuListener listener : listeners) { @@ -77,4 +91,4 @@ public class ModeMenu extends TypeMenu { } }); } -} \ No newline at end of file +} Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/ShowAnnotationsMenu.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/ShowAnnotationsMenu.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/ShowAnnotationsMenu.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/ShowAnnotationsMenu.java Mon Jul 22 12:23:55 2019 @@ -34,18 +34,20 @@ import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; + /** * Creates the show annotations context sub menu. */ public class ShowAnnotationsMenu extends TypeMenu { - private Set<IShowAnnotationsListener> listeners = new HashSet<IShowAnnotationsListener>(); + /** The listeners. */ + private Set<IShowAnnotationsListener> listeners = new HashSet<>(); /** * This collection contains all type names which are displayed in the * editor. */ - private Collection<Type> typesToDisplay = new HashSet<Type>(); + private Collection<Type> typesToDisplay = new HashSet<>(); /** * Editor annotation mode type. This variable is only set if the editor @@ -56,22 +58,30 @@ public class ShowAnnotationsMenu extends /** * Initializes a new instance. - * - * @param typeSystem - * @param shownTypes + * + * @param typeSystem the type system + * @param shownTypes the shown types */ public ShowAnnotationsMenu(TypeSystem typeSystem, Collection<Type> shownTypes) { super(typeSystem.getType(CAS.TYPE_NAME_ANNOTATION), typeSystem); - for (Type type : shownTypes) { - typesToDisplay.add(type); - } + typesToDisplay.addAll(shownTypes); } + /** + * Adds the listener. + * + * @param listener the listener + */ public void addListener(IShowAnnotationsListener listener) { listeners.add(listener); } + /** + * Removes the listener. + * + * @param listener the listener + */ public void removeListener(IShowAnnotationsListener listener) { listeners.remove(listener); } @@ -93,7 +103,8 @@ public class ShowAnnotationsMenu extends // TODO: move this to an action // do not access mTypesToDisplay directly !!! actionItem.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + @Override + public void handleEvent(Event e) { if (actionItem.getSelection()) { typesToDisplay.add(type); @@ -106,26 +117,38 @@ public class ShowAnnotationsMenu extends }); } + /** + * Gets the selected types. + * + * @return the selected types + */ public Collection<Type> getSelectedTypes() { - Collection<Type> selectedTypes = new LinkedList<Type>(); + Collection<Type> selectedTypes = new LinkedList<>(); if (editorAnnotationMode != null) { selectedTypes.add(editorAnnotationMode); } - - for (Type type : typesToDisplay) { - selectedTypes.add(type); - } + + selectedTypes.addAll(typesToDisplay); return Collections.unmodifiableCollection(selectedTypes); } + /** + * Fire changed. + */ private void fireChanged() { for (IShowAnnotationsListener listener : listeners) { listener.selectionChanged(getSelectedTypes()); } } + /** + * Sets the selected type. + * + * @param type the type + * @param isShown the is shown + */ public void setSelectedType(Type type, boolean isShown) { if (typesToDisplay.contains(type)) { @@ -142,18 +165,25 @@ public class ShowAnnotationsMenu extends } } + /** + * Sets the selected types. + * + * @param types the new selected types + */ public void setSelectedTypes(Collection<Type> types) { - typesToDisplay = new HashSet<Type>(); - - for (Type type : types) { - typesToDisplay.add(type); - } + typesToDisplay = new HashSet<>(); + typesToDisplay.addAll(types); for (IShowAnnotationsListener listener : listeners) { listener.selectionChanged(getSelectedTypes()); } } + /** + * Sets the editor annotation mode. + * + * @param newMode the new editor annotation mode + */ public void setEditorAnnotationMode(Type newMode) { if (typesToDisplay.contains(newMode)) { @@ -167,4 +197,4 @@ public class ShowAnnotationsMenu extends fireChanged(); } } -} \ No newline at end of file +} Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/TypeMenu.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/TypeMenu.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/TypeMenu.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/contextmenu/TypeMenu.java Mon Jul 22 12:23:55 2019 @@ -19,7 +19,6 @@ package org.apache.uima.caseditor.editor.contextmenu; -import java.util.Iterator; import java.util.List; import org.apache.uima.cas.Type; @@ -29,19 +28,23 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; + /** * Abstract base class for menus which display the type hierarchy. */ abstract class TypeMenu extends ContributionItem { + + /** The m parent type. */ private Type mParentType; + /** The m type system. */ private TypeSystem mTypeSystem; /** * Initializes a new instance. * - * @param parentType - * @param typeSystem + * @param parentType the parent type + * @param typeSystem the type system */ TypeMenu(Type parentType, TypeSystem typeSystem) { mParentType = parentType; @@ -51,14 +54,21 @@ abstract class TypeMenu extends Contribu /** * Fills the menu with type entries. * - * @param menu - * @param index + * @param menu the menu + * @param index the index */ @Override public void fill(Menu menu, int index) { fillTypeMenu(mParentType, menu, false); } + /** + * Fill type menu. + * + * @param parentType the parent type + * @param parentMenu the parent menu + * @param isParentIncluded the is parent included + */ private void fillTypeMenu(Type parentType, Menu parentMenu, boolean isParentIncluded) { @@ -83,11 +93,7 @@ abstract class TypeMenu extends Contribu insertAction(parentType, newSubMenu); - Iterator<Type> childsIterator = childs.iterator(); - - while (childsIterator.hasNext()) { - Type child = childsIterator.next(); - + for (Type child : childs) { fillTypeMenu(child, newSubMenu, true); } } @@ -100,10 +106,9 @@ abstract class TypeMenu extends Contribu /** * Implementing classes must implement this method to insert * actions into the type menu. - * - * @param type - * @param parentMenu + * + * @param type the type + * @param parentMenu the parent menu */ protected abstract void insertAction(final Type type, Menu parentMenu); - - } \ No newline at end of file + } Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/CreateFeatureStructureDialog.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/CreateFeatureStructureDialog.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/CreateFeatureStructureDialog.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/CreateFeatureStructureDialog.java Mon Jul 22 12:23:55 2019 @@ -39,32 +39,45 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; + +/** + * The Class CreateFeatureStructureDialog. + */ public class CreateFeatureStructureDialog extends IconAndMessageDialog { + /** The title. */ private final String title; + /** The size label. */ private Label sizeLabel; + /** The size text. */ private Text sizeText; + /** The array size. */ private int arraySize; + /** The type system. */ private final TypeSystem typeSystem; + /** The super type. */ private final Type superType; + /** The is array size displayed. */ private boolean isArraySizeDisplayed; - private TypeCombo typeSelection; - + /** The selected type. */ private Type selectedType; + /** The filter types. */ private Collection<Type> filterTypes; /** * Initializes a the current instance. * - * @param parentShell + * @param parentShell the parent shell + * @param superType the super type + * @param typeSystem the type system */ protected CreateFeatureStructureDialog(Shell parentShell, Type superType, TypeSystem typeSystem) { @@ -82,7 +95,7 @@ public class CreateFeatureStructureDialo message = "Please enter the size of the array."; } - filterTypes = new HashSet<Type>(); + filterTypes = new HashSet<>(); filterTypes.add(typeSystem.getType(CAS.TYPE_NAME_ARRAY_BASE)); filterTypes.add(typeSystem.getType(CAS.TYPE_NAME_BYTE)); filterTypes.add(typeSystem.getType(CAS.TYPE_NAME_ANNOTATION_BASE)); @@ -97,12 +110,16 @@ public class CreateFeatureStructureDialo filterTypes.add(typeSystem.getType(CAS.TYPE_NAME_STRING)); } - @Override protected void configureShell(Shell newShell) { newShell.setText(title); } + /** + * Enable size enter. + * + * @param parent the parent + */ private void enableSizeEnter(Composite parent) { if (!isArraySizeDisplayed) { @@ -122,6 +139,7 @@ public class CreateFeatureStructureDialo sizeText.setLayoutData(sizeTextData); sizeText.addModifyListener(new ModifyListener() { + @Override public void modifyText(ModifyEvent event) { try { arraySize = Integer.parseInt(sizeText.getText()); @@ -135,6 +153,9 @@ public class CreateFeatureStructureDialo } } + /** + * Disable size enter. + */ private void disableSizeEnter() { if (isArraySizeDisplayed) { @@ -166,8 +187,8 @@ public class CreateFeatureStructureDialo Label typeLabel = new Label(typePanel, SWT.NONE); typeLabel.setText("Type: "); - - typeSelection = new TypeCombo(typePanel); + + TypeCombo typeSelection = new TypeCombo(typePanel); typeSelection.setInput(superType, typeSystem, filterTypes); selectedType = typeSelection.getType(); @@ -181,6 +202,7 @@ public class CreateFeatureStructureDialo typeSelection.setLayoutData(typeSelectionData); typeSelection.addListener(new ITypePaneListener() { + @Override public void typeChanged(Type newType) { selectedType = newType; @@ -202,7 +224,8 @@ public class CreateFeatureStructureDialo return labelAndText; } - @Override + + @Override protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, "Create", true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); @@ -213,10 +236,20 @@ public class CreateFeatureStructureDialo return getShell().getDisplay().getSystemImage(SWT.ICON_QUESTION); } + /** + * Gets the array size. + * + * @return the array size + */ int getArraySize() { return arraySize; } + /** + * Gets the type. + * + * @return the type + */ Type getType() { return selectedType; } Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/EditView.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/EditView.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/EditView.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/EditView.java Mon Jul 22 12:23:55 2019 @@ -24,34 +24,33 @@ import org.apache.uima.caseditor.editor. import org.apache.uima.caseditor.editor.ICasEditor; import org.eclipse.ui.part.IPageBookViewPage; -/** - * TODO: add javadoc here - */ + public final class EditView extends CasEditorView { - /** - * The ID of the feature structure view. - */ - public static final String ID = "org.apache.uima.caseditor.editview"; - public static final String ID_2 = "org.apache.uima.caseditor.editview2"; - - public EditView() { - super("The edit view is currently not available."); - } - - @Override - protected IPageBookViewPage doCreatePage(ICasEditor editor) { - - IPageBookViewPage result = null; - - ICasDocument document = editor.getDocument(); - - if (document != null) { - EditViewPage page = new EditViewPage(this, editor, document); - - result = page; - } - - return result; - } -} \ No newline at end of file + /** + * The ID of the feature structure view. + */ + public static final String ID = "org.apache.uima.caseditor.editview"; + + /** The Constant ID_2. */ + public static final String ID_2 = "org.apache.uima.caseditor.editview2"; + + /** + * Instantiates a new edits the view. + */ + public EditView() { + super("The edit view is currently not available."); + } + + @Override + protected IPageBookViewPage doCreatePage(ICasEditor editor) { + IPageBookViewPage result = null; + + ICasDocument document = editor.getDocument(); + if (document != null) { + result = new EditViewPage(this, editor, document); + } + + return result; + } +} Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/EditViewPage.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/EditViewPage.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/EditViewPage.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/EditViewPage.java Mon Jul 22 12:23:55 2019 @@ -85,6 +85,7 @@ import org.eclipse.ui.actions.ActionFact import org.eclipse.ui.actions.BaseSelectionListenerAction; import org.eclipse.ui.part.Page; + /** * The {@link EditViewPage} provides basic editing support for {@link FeatureStructure}s. * It shows always the selected {@link FeatureStructure}, but for editing a certain @@ -98,7 +99,16 @@ import org.eclipse.ui.part.Page; */ final class EditViewPage extends Page implements ISelectionListener { + /** + * The Class ValueEditingSupport. + */ private final class ValueEditingSupport extends EditingSupport { + + /** + * Instantiates a new value editing support. + * + * @param viewer the viewer + */ private ValueEditingSupport(ColumnViewer viewer) { super(viewer); } @@ -193,7 +203,7 @@ final class EditViewPage extends Page im // no validator needed } else { - throw new CasEditorError("Unkown array type: " + arrayFS.getClass().getName()); + throw new CasEditorError("Unknown array type: " + arrayFS.getClass().getName()); } } @@ -286,8 +296,14 @@ final class EditViewPage extends Page im } + /** + * The Class DeleteFeatureStructureValue. + */ final class DeleteFeatureStructureValue extends BaseSelectionListenerAction { + /** + * Instantiates a new delete feature structure value. + */ protected DeleteFeatureStructureValue() { super("Delete"); @@ -347,8 +363,14 @@ final class EditViewPage extends Page im } } + /** + * The Class CreateFeatureStructrueValue. + */ private final class CreateFeatureStructrueValue extends BaseSelectionListenerAction { + /** + * Instantiates a new creates the feature structrue value. + */ protected CreateFeatureStructrueValue() { super("Create"); @@ -356,6 +378,13 @@ final class EditViewPage extends Page im } + /** + * Creates the FS. + * + * @param type the type + * @param arraySize the array size + * @return the feature structure + */ FeatureStructure createFS(Type type, int arraySize) { if (type.isPrimitive()) { @@ -367,27 +396,37 @@ final class EditViewPage extends Page im TypeSystem ts = document.getCAS().getTypeSystem(); if (type.isArray()) { - if (type.getName().equals(CAS.TYPE_NAME_BOOLEAN_ARRAY)) { - fs = document.getCAS().createBooleanArrayFS(arraySize); - } else if (type.getName().equals(CAS.TYPE_NAME_BYTE_ARRAY)) { - fs = document.getCAS().createByteArrayFS(arraySize); - } else if (type.getName().equals(CAS.TYPE_NAME_SHORT_ARRAY)) { - fs = document.getCAS().createShortArrayFS(arraySize); - } else if (type.getName().equals(CAS.TYPE_NAME_INTEGER_ARRAY)) { - fs = document.getCAS().createIntArrayFS(arraySize); - } else if (type.getName().equals(CAS.TYPE_NAME_LONG_ARRAY)) { - fs = document.getCAS().createLongArrayFS(arraySize); - } else if (type.getName().equals(CAS.TYPE_NAME_FLOAT_ARRAY)) { - fs = document.getCAS().createFloatArrayFS(arraySize); - } else if (type.getName().equals(CAS.TYPE_NAME_DOUBLE_ARRAY)) { - fs = document.getCAS().createDoubleArrayFS(arraySize); - } else if (type.getName().equals(CAS.TYPE_NAME_STRING_ARRAY)) { - fs = document.getCAS().createStringArrayFS(arraySize); - } else if (type.getName().equals(CAS.TYPE_NAME_FS_ARRAY)) { - fs = document.getCAS().createArrayFS(arraySize); - } else { - throw new CasEditorError("Unkown array type: " + type.getName() + "!"); - } + switch (type.getName()) { + case CAS.TYPE_NAME_BOOLEAN_ARRAY: + fs = document.getCAS().createBooleanArrayFS(arraySize); + break; + case CAS.TYPE_NAME_BYTE_ARRAY: + fs = document.getCAS().createByteArrayFS(arraySize); + break; + case CAS.TYPE_NAME_SHORT_ARRAY: + fs = document.getCAS().createShortArrayFS(arraySize); + break; + case CAS.TYPE_NAME_INTEGER_ARRAY: + fs = document.getCAS().createIntArrayFS(arraySize); + break; + case CAS.TYPE_NAME_LONG_ARRAY: + fs = document.getCAS().createLongArrayFS(arraySize); + break; + case CAS.TYPE_NAME_FLOAT_ARRAY: + fs = document.getCAS().createFloatArrayFS(arraySize); + break; + case CAS.TYPE_NAME_DOUBLE_ARRAY: + fs = document.getCAS().createDoubleArrayFS(arraySize); + break; + case CAS.TYPE_NAME_STRING_ARRAY: + fs = document.getCAS().createStringArrayFS(arraySize); + break; + case CAS.TYPE_NAME_FS_ARRAY: + fs = document.getCAS().createArrayFS(arraySize); + break; + default: + throw new CasEditorError("Unkown array type: " + type.getName() + "!"); + } } else if (ts.subsumes(ts.getType(CAS.TYPE_NAME_ANNOTATION), type)) { @@ -529,21 +568,41 @@ final class EditViewPage extends Page im } } + /** + * The Class PinAction. + */ private static final class PinAction extends Action { + + /** + * Instantiates a new pin action. + */ PinAction() { super("PinAction", IAction.AS_CHECK_BOX); } } + /** The viewer. */ private TreeViewer viewer; + /** The document. */ private ICasDocument document; + + /** The editor. */ private ICasEditor editor; + /** The pin action. */ private PinAction pinAction; + /** The edit view. */ private final EditView editView; + /** + * Instantiates a new edits the view page. + * + * @param editView the edit view + * @param editor the editor + * @param document the document + */ EditViewPage(EditView editView, ICasEditor editor, ICasDocument document) { if (editView == null || document == null) { @@ -593,6 +652,7 @@ final class EditViewPage extends Page im viewer.addDropSupport(DND.DROP_COPY, typesDropSupport, new DropTargetListener() { + @Override public void dragEnter(DropTargetEvent event) { // only the FeatureStructureTransfer is supported // set currentTransferType to FeatureStructureTransfer, if possible @@ -604,12 +664,15 @@ final class EditViewPage extends Page im } } + @Override public void dragLeave(DropTargetEvent event) { } + @Override public void dragOperationChanged(DropTargetEvent event) { } + @Override public void dragOver(DropTargetEvent event) { // TODO: check range type during drag over, like its done in drop() @@ -621,6 +684,7 @@ final class EditViewPage extends Page im } } + @Override public void drop(DropTargetEvent event) { if (FeatureStructureTransfer.getInstance().isSupportedType(event.currentDataType)) { @@ -672,6 +736,7 @@ final class EditViewPage extends Page im } } + @Override public void dropAccept(DropTargetEvent event) { } }); @@ -684,6 +749,7 @@ final class EditViewPage extends Page im source.addDragListener(new DragSourceListener() { TreeItem dragSourceItem = null; + @Override public void dragStart(DragSourceEvent event) { event.doit = false; @@ -701,12 +767,14 @@ final class EditViewPage extends Page im } } + @Override public void dragSetData(DragSourceEvent event) { IAdaptable adaptable = (IAdaptable) dragSourceItem.getData(); event.data = adaptable.getAdapter(FeatureStructure.class); } + @Override public void dragFinished(DragSourceEvent event) { // not needed } @@ -719,6 +787,8 @@ final class EditViewPage extends Page im /** * Retrieves the main control of the edit view. + * + * @return the control */ @Override public Control getControl() { @@ -757,6 +827,7 @@ final class EditViewPage extends Page im ActionFactory.DELETE.create(getSite().getWorkbenchWindow())); } + @Override public void selectionChanged(IWorkbenchPart part, ISelection selection) { if (getSite().getPage().getActiveEditor() == editor) { @@ -781,4 +852,4 @@ final class EditViewPage extends Page im getSite().getPage().removeSelectionListener(this); super.dispose(); } -} \ No newline at end of file +} Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/FeatureColumnLabelProvider.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/FeatureColumnLabelProvider.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/FeatureColumnLabelProvider.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/FeatureColumnLabelProvider.java Mon Jul 22 12:23:55 2019 @@ -25,7 +25,12 @@ import org.apache.uima.caseditor.editor. import org.eclipse.jface.viewers.CellLabelProvider; import org.eclipse.jface.viewers.ViewerCell; + +/** + * The Class FeatureColumnLabelProvider. + */ final class FeatureColumnLabelProvider extends CellLabelProvider { + @Override public void update(ViewerCell cell) { @@ -46,4 +51,4 @@ final class FeatureColumnLabelProvider e throw new CasEditorError("Unkown element!"); } } -} \ No newline at end of file +} Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/FeatureStructureContentProvider.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/FeatureStructureContentProvider.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/FeatureStructureContentProvider.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/FeatureStructureContentProvider.java Mon Jul 22 12:23:55 2019 @@ -37,13 +37,24 @@ import org.eclipse.jface.viewers.ITreeCo import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.widgets.Display; + +/** + * The Class FeatureStructureContentProvider. + */ final class FeatureStructureContentProvider extends AbstractDocumentListener implements ITreeContentProvider { + /** The m document. */ private ICasDocument mDocument; + /** The viewer. */ private Viewer viewer; + /** + * Instantiates a new feature structure content provider. + * + * @param document the document + */ FeatureStructureContentProvider(ICasDocument document) { if (document == null) { @@ -53,6 +64,12 @@ final class FeatureStructureContentProvi mDocument = document; } + /** + * Array size. + * + * @param value the value + * @return the int + */ private int arraySize(FeatureStructure value) { if (!value.getType().isArray()) { @@ -80,6 +97,7 @@ final class FeatureStructureContentProvi return size; } + @Override public Object[] getElements(Object inputElement) { if (inputElement != null) { @@ -90,7 +108,7 @@ final class FeatureStructureContentProvi if (!type.isArray()) { - Collection<FeatureValue> featureValues = new LinkedList<FeatureValue>(); + Collection<FeatureValue> featureValues = new LinkedList<>(); for (Feature feature : type.getFeatures()) { featureValues.add(new FeatureValue(mDocument, featureStructure, feature)); @@ -115,39 +133,42 @@ final class FeatureStructureContentProvi } } + @Override public void dispose() { if (mDocument != null) mDocument.removeChangeListener(this); } + @Override public void inputChanged(final Viewer viewer, Object oldInput, Object newInput) { this.viewer = viewer; if (newInput != null) { - Display.getDefault().syncExec(new Runnable() { - public void run() { - viewer.refresh(); - } - }); + Display.getDefault().syncExec(viewer::refresh); } } + @Override public void added(Collection<FeatureStructure> newFeatureStructure) { } + @Override public void viewChanged(String oldViewName, String newViewName) { changed(); } - + + @Override public void changed() { Display.getDefault().syncExec(new Runnable() { + @Override public void run() { viewer.setInput(null); } }); } + @Override public void removed(Collection<FeatureStructure> deletedFeatureStructure) { for(FeatureStructure fs : deletedFeatureStructure) { if (viewer.getInput() == fs) { @@ -158,8 +179,10 @@ final class FeatureStructureContentProvi } + @Override public void updated(Collection<FeatureStructure> featureStructure) { Display.getDefault().syncExec(new Runnable() { + @Override public void run() { viewer.setSelection(viewer.getSelection()); viewer.refresh(); @@ -167,6 +190,7 @@ final class FeatureStructureContentProvi }); } + @Override public Object[] getChildren(Object parentElement) { if (parentElement instanceof FeatureValue) { @@ -192,10 +216,17 @@ final class FeatureStructureContentProvi } } + @Override public Object getParent(Object element) { return null; } + /** + * Checks for children. + * + * @param value the value + * @return true, if successful + */ private boolean hasChildren(FeatureStructure value) { boolean result; @@ -216,6 +247,7 @@ final class FeatureStructureContentProvi return result; } + @Override public boolean hasChildren(Object element) { if (element instanceof FeatureValue) { @@ -246,4 +278,4 @@ final class FeatureStructureContentProvi throw new CasEditorError("Unkown element type"); } } -} \ No newline at end of file +} Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/ValueColumnLabelProvider.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/ValueColumnLabelProvider.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/ValueColumnLabelProvider.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/ValueColumnLabelProvider.java Mon Jul 22 12:23:55 2019 @@ -28,11 +28,12 @@ import org.apache.uima.caseditor.editor. import org.eclipse.jface.viewers.CellLabelProvider; import org.eclipse.jface.viewers.ViewerCell; + /** * Provides the labels for the edit view. */ final class ValueColumnLabelProvider extends CellLabelProvider { - + @Override public void update(ViewerCell cell) { @@ -75,7 +76,7 @@ final class ValueColumnLabelProvider ext } } else { - throw new CasEditorError("Unkown element!"); + throw new CasEditorError("Unknown element!"); } } } Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/validator/ByteCellEditorValidator.java URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/validator/ByteCellEditorValidator.java?rev=1863543&r1=1863542&r2=1863543&view=diff ============================================================================== --- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/validator/ByteCellEditorValidator.java (original) +++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/editview/validator/ByteCellEditorValidator.java Mon Jul 22 12:23:55 2019 @@ -21,6 +21,7 @@ package org.apache.uima.caseditor.editor import org.eclipse.jface.viewers.ICellEditorValidator; + /** * This {@link ICellEditorValidator} validates {@link String} values which represents a {@link Byte}. * @@ -31,9 +32,10 @@ public class ByteCellEditorValidator imp /** * Checks if the given value is a valid {@link Byte}. * - * @param value + * @param value the value * @return null if valid otherwise an error message */ + @Override public String isValid(Object value) { assert value instanceof String; @@ -45,4 +47,4 @@ public class ByteCellEditorValidator imp return null; } -} \ No newline at end of file +}