From: Patrick Plitzner Date: Tue, 12 Apr 2016 08:03:42 +0000 (+0200) Subject: Merge branch 'develop' into LibrAlign X-Git-Tag: 4.0.0^2~30^2~1 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/83e8037496074ec16da9cfbd0c9f19fd70ab375b Merge branch 'develop' into LibrAlign --- 83e8037496074ec16da9cfbd0c9f19fd70ab375b diff --cc .gitattributes index a9c346ed7,c7b12732e..877a615a0 --- a/.gitattributes +++ b/.gitattributes @@@ -1894,3 -1969,19 +1973,19 @@@ src/site/fml/troubleshooting.fml -tex src/site/resources/css/site.css -text src/site/resources/images/taxeditor_transformed.png -text src/site/site.xml -text + + # The following files will be ignored when merging another + # branch into this branch in case of merge conflict and + # if the 'ours' merge driver is configured. + # WARNING : This merge driver should NOT be set in development + # environments. It is supposed to be used only in CI + # environments. + # The driver can be configured by executing, + # git config --local merge.ours.driver true + **/pom.xml merge=ours + **/MANIFEST.MF merge=ours + **/feature.xml merge=ours + eu.etaxonomy.taxeditor.cdmlib/.classpath merge=ours + eu.etaxonomy.taxeditor.cdmlib/build.properties merge=ours + eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product merge=ours -eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product.with.jre merge=ours ++eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product.with.jre merge=ours diff --cc eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditor.java index 8afc0af98,4934d9a37..57608d5d8 --- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditor.java +++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditor.java @@@ -129,9 -128,6 +129,9 @@@ public class AlignmentEditor extends Ed setDirty(); } }; + private final AlignmentEditorActionUpdater ACTION_UPDATER = new AlignmentEditorActionUpdater(); - public final Clipboard CLIPBOARD = new Clipboard(Display.getCurrent()); //TODO Move to global EDITor class. - ++ public final Clipboard CLIPBOARD = new Clipboard(Display.getCurrent()); //TODO Move to global EDITor class. ++ private MultipleAlignmentsContainer alignmentsContainer = null; private final Map cdmMap = new TreeMap(); //TODO Move this to ContigSequenceDataProvider @@@ -153,24 -149,24 +153,24 @@@ } } - + private void registerEditSettingListener(MultipleAlignmentsContainer container) { - container.getEditSettings().addListener(new EditSettingsListener() { - @Override - public void workingModeChanged(EditSettingsChangeEvent e) {} // Currently nothing to do - - @Override - public void insertLeftInDataAreaChanged(EditSettingsChangeEvent e) { - updateStatusBar(); - refreshToolbarElement(ToggleLeftRightInsertionHandler.COMMAND_ID); - } - - @Override - public void insertChanged(EditSettingsChangeEvent e) { - updateStatusBar(); - refreshToolbarElement(ToggleInsertOverwriteHandler.COMMAND_ID); - } - }); + container.getEditSettings().addListener(new EditSettingsListener() { + @Override + public void workingModeChanged(EditSettingsChangeEvent e) {} // Currently nothing to do + + @Override + public void insertLeftInDataAreaChanged(EditSettingsChangeEvent e) { + updateStatusBar(); + refreshToolbarElement(ToggleLeftRightInsertionHandler.COMMAND_ID); + } + + @Override + public void insertChanged(EditSettingsChangeEvent e) { + updateStatusBar(); + refreshToolbarElement(ToggleInsertOverwriteHandler.COMMAND_ID); + } + }); } @@@ -199,28 -195,25 +199,28 @@@ private AlignmentArea createConsensusHintArea(MultipleAlignmentsContainer container, AlignmentArea labeledArea) { - AlignmentArea result = new AlignmentArea(container); - result.setAllowVerticalScrolling(false); - result.getDataAreas().getBottomAreas().add( - new ConsensusSequenceArea(result.getContentArea(), labeledArea)); - return result; - } + AlignmentArea result = new AlignmentArea(container); + result.setAllowVerticalScrolling(false); + result.getDataAreas().getBottomAreas().add( + new ConsensusSequenceArea(result.getContentArea(), labeledArea)); + return result; + } - + private MultipleAlignmentsContainer getAlignmentsContainer() { if (alignmentsContainer == null) { alignmentsContainer = new MultipleAlignmentsContainer(); - + AlignmentAreaList list = alignmentsContainer.getAlignmentAreas(); AlignmentArea readsArea = createEditableAlignmentArea(alignmentsContainer, true); + readsArea.getSelection().addSelectionListener(ACTION_UPDATER); list.add(createIndexArea(alignmentsContainer, readsArea)); list.add(readsArea); // Make sure READS_AREA_INDEX is correct. - list.add(createEditableAlignmentArea(alignmentsContainer, false)); // Make sure COMSENSUS_AREA_INDEX is correct. + AlignmentArea editableConsensusArea = createEditableAlignmentArea(alignmentsContainer, false); + editableConsensusArea.getSelection().addSelectionListener(ACTION_UPDATER); + list.add(editableConsensusArea); // Make sure COMSENSUS_AREA_INDEX is correct. list.add(createConsensusHintArea(alignmentsContainer, readsArea)); - + registerEditSettingListener(alignmentsContainer); } return alignmentsContainer; @@@ -231,50 -224,12 +231,50 @@@ return getAlignmentsContainer().getAlignmentAreas().get(READS_AREA_INDEX); } - + - private AlignmentArea getEditableConsensusArea() { + public AlignmentArea getEditableConsensusArea() { return getAlignmentsContainer().getAlignmentAreas().get(EDITABLE_CONSENSUS_AREA_INDEX); } - - + + + /** + * Checks whether {@link #getReadsArea()} or {@link #getEditableConsensusArea()} currently - * have the user focus and returns the according component. - * ++ * have the user focus and returns the according component. ++ * + * @return either the reads or the consensus alignment area or {@code null} if none of these + * components is currently focused + */ + public AlignmentArea getFocusedArea() { + AlignmentArea result = getReadsArea(); + if (hasFocus(result)) { + return result; + } + else { + result = getEditableConsensusArea(); + if (hasFocus(result)) { + return result; + } + else { + return null; + } + } + } - - ++ ++ + /** + * Checks whether the specified alignment area or one of its subcomponents currently has the + * focus. - * - * @param area the alignment area to be checked (Can only be {@link #getReadsArea()} or ++ * ++ * @param area the alignment area to be checked (Can only be {@link #getReadsArea()} or + * {@link #getEditableConsensusArea()}.) + * @return {@code true} if the specified component is focused and is either equal to + * {@link #getReadsArea()} or {@link #getEditableConsensusArea()}or {@code false} otherwise + */ + private boolean hasFocus(AlignmentArea area) { + return SWTUtils.childHasFocus((Composite)area.getToolkitComponent()); + } - - ++ ++ public boolean hasPherogram(int sequenceID) { return getReadsArea().getDataAreas().getSequenceAreas(sequenceID).size() > PHEROGRAM_AREA_INDEX; } @@@ -356,7 -311,10 +356,7 @@@ //TODO Can the consensus sequence also be null? / Should it be created here, if nothing is in the DB? } - + - /* (non-Javadoc) - * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) - */ @Override public void createPartControl(Composite parent) { SWTComponentFactory.getInstance().getSWTComponent(getAlignmentsContainer(), parent, SWT.NONE); @@@ -383,17 -339,8 +383,18 @@@ } } - + - private void updateStatusBar() { + @Override + public void dispose() { + Display.getCurrent().removeFilter(SWT.FocusIn, ACTION_UPDATER); + Display.getCurrent().removeFilter(SWT.FocusOut, ACTION_UPDATER); + CLIPBOARD.dispose(); ++ ((AlignmentEditorInput)getEditorInput()).dispose(); + super.dispose(); + } + + + private void updateStatusBar() { IActionBars bars = getEditorSite().getActionBars(); bars.getStatusLineManager().setMessage("Edit mode: " + (getReadsArea().getEditSettings().isInsert() ? "Insert" : "Overwrite") + " " + @@@ -412,7 -359,10 +413,7 @@@ return shifts.toArray(new Shift[]{}); } - + - /* (non-Javadoc) - * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor) - */ @Override public void doSave(IProgressMonitor monitor) { if (getEditorInput() instanceof AlignmentEditorInput) { @@@ -479,18 -431,41 +482,18 @@@ } } - + - /* (non-Javadoc) - * @see org.eclipse.ui.part.EditorPart#doSaveAs() - */ @Override public void doSaveAs() {} - + - /* (non-Javadoc) - * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput) - */ @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { setSite(site); setInput(input); - System.out.println("AlignmentEditor.init(): " + ActionFactory.COPY.getId()); - site.getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), new Action(ActionFactory.COPY.getId()) { - @Override - public boolean isEnabled() { - System.out.println("isEnabled()"); - return true; - } - - @Override - public void run() { - System.out.println("run"); - super.run(); - } - }); } - + - /* (non-Javadoc) - * @see org.eclipse.ui.part.EditorPart#isDirty() - */ @Override public boolean isDirty() { return dirty; @@@ -502,21 -477,29 +505,21 @@@ firePropertyChange(IEditorPart.PROP_DIRTY); } - + - /* (non-Javadoc) - * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed() - */ @Override public boolean isSaveAsAllowed() { return false; // "Save as" not allowed. } - + @Override public void setFocus() { - if(conversationHolder!=null){ + if(conversationHolder != null){ conversationHolder.bind(); } + ((AlignmentEditorInput)getEditorInput()).bind(); } - - @Override - public void dispose() { - ((AlignmentEditorInput)getEditorInput()).dispose(); - } - public boolean isInsertMode() { return getAlignmentsContainer().getEditSettings().isInsert(); }