Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/org.eclipse.papyrus.infra.onefile/src/org/eclipse/papyrus/infra/onefile/providers/PapyrusLabelProvider.java')
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.onefile/src/org/eclipse/papyrus/infra/onefile/providers/PapyrusLabelProvider.java67
1 files changed, 67 insertions, 0 deletions
diff --git a/plugins/infra/org.eclipse.papyrus.infra.onefile/src/org/eclipse/papyrus/infra/onefile/providers/PapyrusLabelProvider.java b/plugins/infra/org.eclipse.papyrus.infra.onefile/src/org/eclipse/papyrus/infra/onefile/providers/PapyrusLabelProvider.java
new file mode 100644
index 00000000000..b1b4a45581f
--- /dev/null
+++ b/plugins/infra/org.eclipse.papyrus.infra.onefile/src/org/eclipse/papyrus/infra/onefile/providers/PapyrusLabelProvider.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos Origin Integration.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tristan Faure (Atos Origin Integration) tristan.faure@atosorigin.com - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.onefile.providers;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.papyrus.infra.onefile.model.IPapyrusFile;
+import org.eclipse.papyrus.infra.onefile.model.ISubResourceFile;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Label Provider for Papyrus Model Elements
+ *
+ * @author tristan.faure@atosorigin.com
+ *
+ */
+public class PapyrusLabelProvider implements ILabelProvider {
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return true;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ public Image getImage(Object element) {
+ if (element instanceof IPapyrusFile) {
+ IPapyrusFile papyFile = (IPapyrusFile) element;
+ return papyFile.getImage();
+ }
+ if (element instanceof ISubResourceFile) {
+ return ((ISubResourceFile) element).getImage();
+ }
+ return null;
+ }
+
+ public String getText(Object element) {
+ if (element instanceof IPapyrusFile) {
+ IPapyrusFile papyFile = (IPapyrusFile) element;
+ return papyFile.getText();
+ }
+ if (element instanceof ISubResourceFile) {
+ return ((ISubResourceFile) element).getText();
+ }
+ if (element instanceof IResource) {
+ return ((IResource) element).getName();
+ }
+ return null;
+ }
+
+}

Back to the top