Project

General

Profile

« Previous | Next » 

Revision 7f6ce378

Added by Patrick Plitzner over 6 years ago

ref #6925 correctly acces EPartService

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenDerivateViewHandler.java
16 16

  
17 17
    @Override
18 18
    public Object execute(ExecutionEvent event) throws ExecutionException {
19
        EPartService partService = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class);
19
        EPartService partService = TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
20 20
        MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW);
21 21
        partService.showPart(part, PartState.ACTIVATE);
22 22
        DerivateView derivateView = (DerivateView) part.getObject();
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/defaultHandler/DefaultOpenSpecimenEditorForTypeSpecimenHandler.java
26 26
	@Override
27 27
	protected void open(ExecutionEvent event, SpecimenTypeDesignation entity) {
28 28
	    DerivateViewEditorInput input = new DerivateViewEditorInput(entity.getUuid());
29
	    MPart part = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class).showPart(
29
	    MPart part = TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class).showPart(
30 30
	            AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW, PartState.ACTIVATE);
31 31
	    DerivateView derivateView = (DerivateView) part.getObject();
32 32
	    derivateView.init(input);
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForDescriptionElement.java
42 42
        if(associatedSpecimenOrObservation!=null){
43 43
            UUID specimenUuid = associatedSpecimenOrObservation.getUuid();
44 44
            DerivateViewEditorInput input = new DerivateViewEditorInput(Collections.singletonList(specimenUuid));
45
            MPart part = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class).showPart(
45
            MPart part = TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class).showPart(
46 46
                    AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW, PartState.ACTIVATE);
47 47
            DerivateView derivateView = (DerivateView) part.getObject();
48 48
            derivateView.init(input);
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForSpecimenOrOBservationBase.java
32 32
    @Override
33 33
    protected void open(ExecutionEvent event, SpecimenOrObservationBase<?> entity) {
34 34
        DerivateViewEditorInput input = new DerivateViewEditorInput(entity.getUuid());
35
        MPart part = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class).showPart(
35
        MPart part = TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class).showPart(
36 36
                AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW, PartState.ACTIVATE);
37 37
        DerivateView derivateView = (DerivateView) part.getObject();
38 38
        derivateView.init(input);
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForTaxonNode.java
43 43
            specimenUuids.add(specimenOrObservationBase.getUuid());
44 44
        }
45 45
        DerivateViewEditorInput input = new DerivateViewEditorInput(specimenUuids, taxonUuid);
46
        MPart part = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class).showPart(
46
        MPart part = TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class).showPart(
47 47
                AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW, PartState.ACTIVATE);
48 48
        DerivateView derivateView = (DerivateView) part.getObject();
49 49
        derivateView.init(input);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/OpenReferencingObjectsView.java
12 12

  
13 13
    @Override
14 14
    public Object execute(ExecutionEvent event) throws ExecutionException {
15
        TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class).showPart(
15
        TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class).showPart(
16 16
                eu.etaxonomy.taxeditor.bulkeditor.AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_REFERENCINGOBJECTS_E4_REFERENCINGOBJECTSVIEWE4,
17 17
                PartState.ACTIVATE);
18 18
        return null;
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java
558 558
            IEditorPart activeEditor = getActivePage().getActiveEditor();
559 559
            Object activePart = getActivePage().getActivePart();
560 560
            if(activeEditor==null){
561
                activePart = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class).getActivePart();
561
                activePart = TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class).getActivePart();
562 562
            }
563 563
            Object wrappedPart = WorkbenchUtility.getE4WrappedPart(activePart);
564 564
            return wrappedPart!=null?wrappedPart:activeEditor;
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java
57 57
	public static String ID = "eu.etaxonomy.taxeditor.view.detail"; //$NON-NLS-1$
58 58

  
59 59
	private DetailsViewer viewer;
60
	
60

  
61 61
	private CdmBase lastObject;
62 62
	private Object lastPart;
63 63

  
......
85 85
	    try{
86 86
	        boolean isSelectionProvidingPartStillActive = false;
87 87
	        if(selectionProvidingPart!=null){
88
	            EPartService partService = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class);
88
	            EPartService partService = TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
89 89
	            Collection<MPart> parts = partService.getParts();
90 90
	            for (MPart mPart : parts) {
91 91
	                Object object = mPart.getObject();
......
163 163
	@Override
164 164
	public void showEmptyPage() {
165 165
	    viewer.setSelection(null);
166
	    
166

  
167 167
	    super.showEmptyPage();
168 168
	}
169 169

  
......
234 234
    }
235 235
    @Override
236 236
    public void showViewer(Object part, IStructuredSelection selection){
237
    	
238
    	
239
    	
237

  
238

  
239

  
240 240
    	this.part = part;
241 241

  
242 242
        Object element = selection.getFirstElement();
243
        
243

  
244 244
//        if (part == lastPart && element == lastObject ){
245 245
//        	getViewer().setInput(element);
246 246
//        	return;

Also available in: Unified diff