Revision 4fff2d21
Added by Katja Luther about 5 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/SetPublishFlagForSubtreeHandlerE4.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler; |
11 | 11 |
|
12 |
import java.util.Collection; |
|
13 |
import java.util.Iterator; |
|
14 |
|
|
12 | 15 |
import javax.inject.Named; |
13 | 16 |
|
14 | 17 |
import org.eclipse.core.commands.operations.AbstractOperation; |
15 | 18 |
import org.eclipse.core.runtime.IStatus; |
19 |
import org.eclipse.core.runtime.NullProgressMonitor; |
|
16 | 20 |
import org.eclipse.core.runtime.Status; |
17 | 21 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
18 | 22 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
19 | 23 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
20 | 24 |
import org.eclipse.e4.ui.services.IServiceConstants; |
25 |
import org.eclipse.jface.dialogs.MessageDialog; |
|
21 | 26 |
import org.eclipse.jface.viewers.IStructuredSelection; |
22 | 27 |
import org.eclipse.jface.viewers.TreeSelection; |
23 | 28 |
import org.eclipse.jface.window.Window; |
... | ... | |
27 | 32 |
import eu.etaxonomy.cdm.api.service.config.PublishForSubtreeConfigurator; |
28 | 33 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
29 | 34 |
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto; |
35 |
import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4; |
|
36 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
|
37 |
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4; |
|
30 | 38 |
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels; |
31 | 39 |
import eu.etaxonomy.taxeditor.navigation.navigator.operation.SetPublishForSubtreeOperation; |
32 | 40 |
import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4; |
33 | 41 |
import eu.etaxonomy.taxeditor.ui.dialog.configurator.SetPublishForSubtreeWizard; |
42 |
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility; |
|
34 | 43 |
|
35 | 44 |
/** |
36 | 45 |
* @author k.luther |
... | ... | |
77 | 86 |
"unknown", //$NON-NLS-1$ |
78 | 87 |
TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE); |
79 | 88 |
} |
89 |
Collection<MPart> dirtyParts = EditorUtil.checkForChanges(null, partService); |
|
90 |
|
|
91 |
if (dirtyParts != null && !dirtyParts.isEmpty()){ |
|
92 |
boolean proceed = MessageDialog.openQuestion(null, |
|
93 |
"There are unsaved changes", "Do you want to save the changes?"); |
|
94 |
Iterator<MPart> partIterator = dirtyParts.iterator(); |
|
95 |
while( partIterator.hasNext() ){ |
|
96 |
MPart part = partIterator.next(); |
|
97 |
if (proceed) { |
|
98 |
if (part != null){ |
|
99 |
if (part.getElementId().equals("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4")){ |
|
100 |
TaxonNameEditorE4 targetEditor = (TaxonNameEditorE4) WorkbenchUtility.getE4WrappedPart(part); |
|
101 |
targetEditor.save(new NullProgressMonitor()); |
|
102 |
}else if (part.getElementId().equals("bulkeditor.editor")){ |
|
103 |
BulkEditorE4 targetEditor = (BulkEditorE4) WorkbenchUtility.getE4WrappedPart(part); |
|
104 |
targetEditor.save(new NullProgressMonitor()); |
|
105 |
} |
|
106 |
|
|
107 |
} |
|
108 |
|
|
109 |
} |
|
110 |
} |
|
111 |
} |
|
112 |
|
|
113 |
|
|
80 | 114 |
configurator = new PublishForSubtreeConfigurator(taxonNode.getUuid()); |
81 | 115 |
SetPublishForSubtreeWizard wizard = new SetPublishForSubtreeWizard(configurator); |
82 | 116 |
|
Also available in: Unified diff
fix #7428: ask for saving and update open views for subtree operations