Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/textedit/org.eclipse.papyrus.infra.textedit.modelexplorer/src/org/eclipse/papyrus/infra/textedit/modelexplorer/internal/queries/GetTextDocumentIconQuery.java')
-rwxr-xr-xplugins/infra/textedit/org.eclipse.papyrus.infra.textedit.modelexplorer/src/org/eclipse/papyrus/infra/textedit/modelexplorer/internal/queries/GetTextDocumentIconQuery.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/plugins/infra/textedit/org.eclipse.papyrus.infra.textedit.modelexplorer/src/org/eclipse/papyrus/infra/textedit/modelexplorer/internal/queries/GetTextDocumentIconQuery.java b/plugins/infra/textedit/org.eclipse.papyrus.infra.textedit.modelexplorer/src/org/eclipse/papyrus/infra/textedit/modelexplorer/internal/queries/GetTextDocumentIconQuery.java
new file mode 100755
index 00000000000..d6f1ca29a51
--- /dev/null
+++ b/plugins/infra/textedit/org.eclipse.papyrus.infra.textedit.modelexplorer/src/org/eclipse/papyrus/infra/textedit/modelexplorer/internal/queries/GetTextDocumentIconQuery.java
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * Copyright (c) 2021 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) <vincent.lorenzo@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.textedit.modelexplorer.internal.queries;
+
+import org.eclipse.papyrus.emf.facet.custom.metamodel.custompt.IImage;
+import org.eclipse.papyrus.emf.facet.custom.ui.ImageUtils;
+import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;
+import org.eclipse.papyrus.infra.textedit.textdocument.TextDocument;
+import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
+
+/**
+ * Query to retrieve the path to the icon of the corresponding text document.
+ *
+ */
+public class GetTextDocumentIconQuery implements IJavaQuery2<TextDocument, IImage> {
+
+ /**
+ * @see org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2#evaluate(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2, org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager)
+ *
+ * @param context
+ * @param parameterValues
+ * @param facetManager
+ * @return
+ * the icon
+ * @throws DerivedTypedElementException
+ */
+ @Override
+ public IImage evaluate(final TextDocument context, final IParameterValueList2 parameterValues, final IFacetManager facetManager) throws DerivedTypedElementException {
+ ViewPrototype prototype = ViewPrototype.get(context);
+ return (prototype != null) ? ImageUtils.wrap(prototype.getIconURI()) : null;
+ }
+}

Back to the top