diff options
6 files changed, 60 insertions, 14 deletions
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/META-INF/MANIFEST.MF b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/META-INF/MANIFEST.MF index f3ca82161d8..87e0f1da698 100644..100755 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/META-INF/MANIFEST.MF +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/META-INF/MANIFEST.MF @@ -11,9 +11,10 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: org.eclipse.papyrus.infra.core.sasheditor;bundle-version="[2.1.0,3.0.0)";visibility:=reexport, org.eclipse.emf.transaction;bundle-version="[1.9.0,2.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, - org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="[1.2.0,2.0.0)";visibility:=reexport + org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="[1.3.0,2.0.0)";visibility:=reexport, + org.eclipse.papyrus.infra.core;bundle-version="[3.0.200,4.0.0)" Bundle-Vendor: %providerName -Bundle-Version: 2.0.0.qualifier +Bundle-Version: 2.0.100.qualifier Bundle-Activator: org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.Activator Bundle-ManifestVersion: 2 Bundle-SymbolicName: org.eclipse.papyrus.infra.core.sasheditor.di;singleton:=true diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalPageManagerImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalPageManagerImpl.java index e974c5e8756..4670f4cf8a0 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalPageManagerImpl.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalPageManagerImpl.java @@ -11,12 +11,21 @@ * Contributors: * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation * Christian W. Damus - bug 485220 - * + * Vincent Lorenzo (CEA LIST) vincent.lorenzo - Bug 548998 *****************************************************************************/ package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.resource.ModelsReader; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.Activator; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils.TransactionHelper; import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr; @@ -154,4 +163,38 @@ public class TransactionalPageManagerImpl extends PageManagerImpl { } } + + /** + * @see org.eclipse.papyrus.infra.core.sashwindows.di.service.BasicPageManagerImpl#allPages() + * + * @return + */ + @Override + public List<Object> allPages() { + if (false == isLegacyMode()) { + final ResourceSet set = this.editingDomain.getResourceSet(); + if (set instanceof ModelSet) { + final ModelSet modelSet = (ModelSet) set; + final URI uri = modelSet.getURIWithoutExtension(); + final ModelsReader reader = new ModelsReader(); + List<Object> result = new ArrayList<>(); + for (URI currentURI : reader.getKnownModelURIs(uri)) { + final String fileExtension = currentURI.fileExtension(); + // this filter on uml is not the best solution, but we currently don't have other way to get all pages properly + if (!"uml".equals(fileExtension)) {// to avoid to cross all UML contents for nothing (and avoid time consumption) //$NON-NLS-1$ + List<Resource> notationResources = getResources(fileExtension); + for (Resource notationResource : notationResources) { + for (EObject content : notationResource.getContents()) { + if (isPage(content)) { + result.add(content); + } + } + } + } + } + return result; + } + } + return super.allPages(); + } } diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/pom.xml b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/pom.xml index 87a59d6f571..5c26d63a24d 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/pom.xml +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/pom.xml @@ -9,6 +9,6 @@ <version>0.0.1-SNAPSHOT</version> </parent> <artifactId>org.eclipse.papyrus.infra.core.sasheditor.di</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.100-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project>
\ No newline at end of file diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/META-INF/MANIFEST.MF b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/META-INF/MANIFEST.MF index eab0a07d344..3ccd6b938fb 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/META-INF/MANIFEST.MF +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/META-INF/MANIFEST.MF @@ -16,7 +16,7 @@ Require-Bundle: org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility org.eclipse.emf.transaction;bundle-version="[1.9.0,2.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)" Bundle-Vendor: %providerName -Bundle-Version: 1.2.0.qualifier +Bundle-Version: 1.3.0.qualifier Bundle-ManifestVersion: 2 Bundle-SymbolicName: org.eclipse.papyrus.infra.core.sashwindows.di;singleton:=true Automatic-Module-Name: org.eclipse.papyrus.infra.core.sashwindows.di diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/pom.xml b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/pom.xml index b4516846e27..76f26d72424 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/pom.xml +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/pom.xml @@ -9,6 +9,6 @@ <version>0.0.1-SNAPSHOT</version> </parent> <artifactId>org.eclipse.papyrus.infra.core.sashwindows.di</artifactId> - <version>1.2.0-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project>
\ No newline at end of file diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/BasicPageManagerImpl.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/BasicPageManagerImpl.java index eb638489f27..f2ca28a885c 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/BasicPageManagerImpl.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sashwindows.di/src/org/eclipse/papyrus/infra/core/sashwindows/di/service/BasicPageManagerImpl.java @@ -14,7 +14,7 @@ * CĂ©line Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 415638 * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 440754 * Christian W. Damus - bug 485220 - * + * *****************************************************************************/ package org.eclipse.papyrus.infra.core.sashwindows.di.service; @@ -112,10 +112,10 @@ public class BasicPageManagerImpl implements IPageManager { /** * Remove a page. - * + * * @param pageIdentifier * identifies the page to remove - * + * * @deprecated Use the {@linkplain #closeAllOpenedPages(Object)} method, instead */ @Deprecated @@ -172,6 +172,7 @@ public class BasicPageManagerImpl implements IPageManager { result = legacyAllPages(); } else { // FIXME: Temporary, naive code. Need to implement a mechanism to contribute page providers + // fixed in subclass to avoir cyclic dependency problem (see bug 548998) result = new ArrayList<>(); List<Resource> notationResources = getResources("notation"); @@ -218,7 +219,7 @@ public class BasicPageManagerImpl implements IPageManager { */ @Override public List<Object> allLocalPages(ILocalPageService service) { - List<Object> result = new LinkedList<Object>(); + List<Object> result = new LinkedList<>(); for (Object next : allPages()) { if (service.isLocalPage(next)) { @@ -240,7 +241,7 @@ public class BasicPageManagerImpl implements IPageManager { @Override public List<Object> getAssociatedPages(Object uriTrim) { - List<Object> list = new ArrayList<Object>(); + List<Object> list = new ArrayList<>(); SashModel sashModel = diSashModel.getSashModel(); Iterator<?> iter = sashModel.eAllContents(); @@ -282,9 +283,10 @@ public class BasicPageManagerImpl implements IPageManager { * @param fileExtension * the file extension * @return the resources + * @since 1.3 */ - private List<Resource> getResources(String fileExtension) { - List<Resource> resourcesList = new LinkedList<Resource>(); + protected List<Resource> getResources(String fileExtension) { + List<Resource> resourcesList = new LinkedList<>(); // Get the contextual resources from the sash model ResourceSet resourceSet = diSashModel.eResource().getResourceSet(); @@ -318,7 +320,7 @@ public class BasicPageManagerImpl implements IPageManager { /** * Obtains the currently active tab folder, whatever that might mean in the * context of the page manager. - * + * * @return the current folder, never {@code null} because at least one folder always * implicitly exists */ |