Revision b4730c9a
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/TaxonNameEditorE4.java | ||
---|---|---|
43 | 43 |
import org.eclipse.ui.ISelectionListener; |
44 | 44 |
import org.eclipse.ui.IWorkbenchPart; |
45 | 45 |
import org.eclipse.ui.IWorkbenchPartReference; |
46 |
import org.eclipse.ui.PlatformUI; |
|
47 | 46 |
import org.eclipse.ui.forms.ManagedForm; |
48 | 47 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
49 | 48 |
import org.eclipse.ui.forms.widgets.ScrolledForm; |
... | ... | |
234 | 233 |
conversation.bind(); |
235 | 234 |
} |
236 | 235 |
if(input!=null){ |
237 |
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus(); |
|
238 | 236 |
if (getSelectedContainer() == null) { |
239 | 237 |
throw new IllegalStateException( |
240 | 238 |
Messages.TaxonNameEditor_THERE_SHOULD_ALWAYS_BE); |
... | ... | |
400 | 398 |
|
401 | 399 |
createOrUpdateNameComposites(); |
402 | 400 |
|
403 |
setFocus(); |
|
404 |
|
|
405 | 401 |
createDragSupport(); |
406 | 402 |
|
407 | 403 |
setPartName(); |
404 |
|
|
405 |
//set initial selection |
|
406 |
selService.setSelection(new StructuredSelection(input.getTaxon())); |
|
408 | 407 |
} |
409 | 408 |
|
410 | 409 |
private void createDragSupport() { |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/AbstractCdmEditorPartE4.java | ||
---|---|---|
16 | 16 |
|
17 | 17 |
import org.eclipse.e4.core.di.annotations.Optional; |
18 | 18 |
import org.eclipse.e4.ui.di.PersistState; |
19 |
import org.eclipse.e4.ui.di.UISynchronize; |
|
19 | 20 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
20 | 21 |
import org.eclipse.e4.ui.services.IServiceConstants; |
21 | 22 |
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; |
... | ... | |
23 | 24 |
import org.eclipse.jface.viewers.IStructuredSelection; |
24 | 25 |
import org.eclipse.jface.viewers.StructuredSelection; |
25 | 26 |
import org.eclipse.jface.viewers.Viewer; |
26 |
import org.eclipse.swt.widgets.Display; |
|
27 | 27 |
|
28 | 28 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
29 | 29 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
... | ... | |
122 | 122 |
public void selectionChanged( |
123 | 123 |
@Named(IServiceConstants.ACTIVE_SELECTION)Object selection, |
124 | 124 |
@Named(IServiceConstants.ACTIVE_PART)MPart activePart, |
125 |
MPart thisPart){ |
|
125 |
MPart thisPart, UISynchronize sync){
|
|
126 | 126 |
if(previousSelection==null || |
127 | 127 |
!previousSelection.equals(selection)){//skip redundant rendering of details view |
128 |
Object savablePart = WorkbenchUtility.findSavablePart(this); |
|
129 |
if(savablePart==null){ |
|
130 |
showEmptyPage(); |
|
131 |
} |
|
132 | 128 |
if(delaySelection==null){ |
133 | 129 |
delaySelection = new DelaySelection(selection, activePart, thisPart); |
134 | 130 |
} |
... | ... | |
137 | 133 |
delaySelection.setThisPart(thisPart); |
138 | 134 |
if(!isInDelay){ |
139 | 135 |
isInDelay = true; |
140 |
Display.getCurrent().asyncExec(delaySelection); |
|
136 |
sync.asyncExec(delaySelection); |
|
137 |
selectionProvidingPart = activePart; |
|
138 |
previousSelection = selection; |
|
141 | 139 |
} |
142 | 140 |
} |
143 | 141 |
} |
... | ... | |
192 | 190 |
} |
193 | 191 |
|
194 | 192 |
} |
195 |
selectionProvidingPart = activePart; |
|
196 |
previousSelection = selection; |
|
197 | 193 |
} |
198 | 194 |
} |
199 | 195 |
|
Also available in: Unified diff
Fix selection handling for name editor