10 |
10 |
package eu.etaxonomy.taxeditor;
|
11 |
11 |
|
12 |
12 |
import java.util.Arrays;
|
|
13 |
import java.util.Collection;
|
13 |
14 |
import java.util.List;
|
14 |
15 |
|
15 |
16 |
import javax.inject.Inject;
|
16 |
17 |
|
17 |
18 |
import org.eclipse.core.runtime.IProgressMonitor;
|
|
19 |
import org.eclipse.e4.core.contexts.IEclipseContext;
|
|
20 |
import org.eclipse.e4.core.di.annotations.Optional;
|
|
21 |
import org.eclipse.e4.ui.di.UIEventTopic;
|
18 |
22 |
import org.eclipse.e4.ui.model.application.MApplication;
|
19 |
23 |
import org.eclipse.e4.ui.model.application.ui.MElementContainer;
|
20 |
24 |
import org.eclipse.e4.ui.model.application.ui.MUIElement;
|
21 |
25 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
|
26 |
import org.eclipse.e4.ui.workbench.UIEvents;
|
22 |
27 |
import org.eclipse.e4.ui.workbench.lifecycle.PostContextCreate;
|
23 |
28 |
import org.eclipse.e4.ui.workbench.lifecycle.PreSave;
|
24 |
29 |
import org.eclipse.e4.ui.workbench.lifecycle.ProcessAdditions;
|
25 |
30 |
import org.eclipse.e4.ui.workbench.lifecycle.ProcessRemovals;
|
26 |
31 |
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
|
32 |
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
27 |
33 |
import org.eclipse.ui.IMemento;
|
|
34 |
import org.osgi.service.event.Event;
|
28 |
35 |
|
29 |
36 |
import eu.etaxonomy.taxeditor.model.IContextListener;
|
30 |
37 |
import eu.etaxonomy.taxeditor.store.CdmStore;
|
... | ... | |
66 |
73 |
private void preSave(){
|
67 |
74 |
}
|
68 |
75 |
|
|
76 |
@Inject
|
|
77 |
@Optional
|
|
78 |
public void subscribeAppShutdownStarted(@UIEventTopic(UIEvents.UILifeCycle.APP_SHUTDOWN_STARTED) Event event,
|
|
79 |
MApplication application) {
|
|
80 |
IEclipseContext context = application.getContext();
|
|
81 |
EPartService partService = context.get(EPartService.class);
|
|
82 |
Collection<MPart> dirtyParts = partService.getDirtyParts();
|
|
83 |
if(!dirtyParts.isEmpty()){
|
|
84 |
partService.saveAll(true);
|
|
85 |
}
|
|
86 |
}
|
|
87 |
|
69 |
88 |
private void hideParts() {
|
70 |
89 |
List<MPart> elements = modelService.findElements(application, null, MPart.class, Arrays.asList(NON_RESTORE));
|
71 |
90 |
for (MPart part : elements) {
|
ref #6763 Prompt for save when closing workbench