Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/utils/IPageUtils.java')
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/utils/IPageUtils.java98
1 files changed, 0 insertions, 98 deletions
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/utils/IPageUtils.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/utils/IPageUtils.java
index cac86d97047..a719de92179 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/utils/IPageUtils.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/utils/IPageUtils.java
@@ -16,25 +16,11 @@
package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils;
-import java.util.HashMap;
-import java.util.Map;
-
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
-import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageManagerImpl;
-import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageManagerImpl.SashModelOperation;
import org.eclipse.papyrus.infra.core.sasheditor.editor.ICloseablePart;
import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage;
import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
-import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel;
-import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr;
-import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder;
-import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiSwitch;
/**
@@ -84,90 +70,6 @@ public class IPageUtils {
}
/**
- * Obtains a command that will close all of the pages in the given {@code pageManager} that reference the specified {@code pageIdentifier},
- * regardless of whether they still reference that identifier at the time of execution (this is the "memoization").
- *
- * @param domain
- * the editing domain in which the command will be executed
- * @param pageManager
- * the page manager for which to construct the command
- * @param pageIdentifier
- * the identifier of the page(s) to be removed
- *
- * @return the memoized close-all-pages command, or {@code null} if there are no pages to close
- */
- public static Command getMemoizedCloseAllPagesCommand(final TransactionalEditingDomain domain, final IPageManager pageManager, final Object pageIdentifier) {
- Command result = null;
-
- final PageManagerImpl pageMan = (PageManagerImpl) pageManager;
-
- final Map<PageRef, TabFolder> pages = execute(pageMan, new SashModelOperation<Map<PageRef, TabFolder>>() {
-
- @Override
- public Map<PageRef, TabFolder> execute(SashWindowsMngr sashWindowsManager) {
- return new DiSwitch<Map<PageRef, TabFolder>>() {
-
- private Map<PageRef, TabFolder> pages = new HashMap<PageRef, TabFolder>();
-
- @Override
- public Map<PageRef, TabFolder> defaultCase(EObject object) {
- for (EObject next : object.eContents()) {
- doSwitch(next);
- }
- return pages;
- }
-
- @Override
- public Map<PageRef, TabFolder> casePageRef(PageRef object) {
- if (object.getPageIdentifier() == pageIdentifier) {
- pages.put(object, object.getParent());
- }
- return pages;
- }
- }.doSwitch(sashWindowsManager.getSashModel());
- }
- });
-
-
- if (!pages.isEmpty()) {
- final SashModelOperation<Void> removeOp = new SashModelOperation<Void>() {
-
- @Override
- public Void execute(SashWindowsMngr sashWindowsManager) {
- SashModel sashModel = sashWindowsManager.getSashModel();
- for (Map.Entry<PageRef, TabFolder> next : pages.entrySet()) {
- PageRef page = next.getKey();
- TabFolder folder = next.getValue();
-
- folder.getChildren().remove(page);
- sashModel.removeEmptyFolder(folder);
- }
- return null;
- }
- };
-
- result = new RecordingCommand(domain, "Remove Editor Page(s)") { //$NON-NLS-1$
-
- @Override
- protected void doExecute() {
- IPageUtils.execute(pageMan, removeOp);
- }
- };
- }
-
- return result;
- }
-
- private static <T> T execute(PageManagerImpl pageManager, SashModelOperation<T> sashOperation) {
- try {
- return pageManager.execute(sashOperation);
- } catch (IllegalAccessException e) {
- // Won't happen because this is our own operation
- throw new IllegalAccessError(e.getLocalizedMessage());
- }
- }
-
- /**
* Queries whether the user should be permitted to close a {@code page}.
*
* @param page

Back to the top