Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.sirius.table.ui/src')
-rw-r--r--plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/business/internal/dialect/HierarchyLabelTableProvider.java90
-rw-r--r--plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/business/internal/dialect/TableDialectUIServices.java89
2 files changed, 3 insertions, 176 deletions
diff --git a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/business/internal/dialect/HierarchyLabelTableProvider.java b/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/business/internal/dialect/HierarchyLabelTableProvider.java
deleted file mode 100644
index 0899736df1..0000000000
--- a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/business/internal/dialect/HierarchyLabelTableProvider.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.sirius.table.ui.business.internal.dialect;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.sirius.business.api.query.IdentifiedElementQuery;
-import org.eclipse.sirius.table.metamodel.table.description.TableDescription;
-import org.eclipse.sirius.table.metamodel.table.description.TableMapping;
-import org.eclipse.sirius.table.metamodel.table.description.TableNavigationDescription;
-import org.eclipse.sirius.table.metamodel.table.provider.Messages;
-import org.eclipse.sirius.viewpoint.description.Group;
-import org.eclipse.sirius.viewpoint.description.IdentifiedElement;
-import org.eclipse.sirius.viewpoint.description.RepresentationExtensionDescription;
-import org.eclipse.sirius.viewpoint.description.tool.ToolEntry;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * A label provider for mappings to display their hierarchy.
- *
- * @author jdupont
- */
-public class HierarchyLabelTableProvider extends LabelProvider {
-
- private static final String DELIMITER = " > "; //$NON-NLS-1$
-
- private ILabelProvider wrappedProvider;
-
- /**
- * Create a new instance with wrapped label provider as base type.
- *
- * @param wrappedLabelProvider
- * the wrapped label provider
- */
- public HierarchyLabelTableProvider(final ILabelProvider wrappedLabelProvider) {
- this.wrappedProvider = wrappedLabelProvider;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
- */
- @Override
- public Image getImage(final Object element) {
- return wrappedProvider != null ? wrappedProvider.getImage(element) : super.getImage(element);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
- */
- @Override
- public String getText(final Object element) {
- if (element instanceof TableMapping || element instanceof TableDescription || element instanceof TableNavigationDescription || element instanceof ToolEntry) {
- final IdentifiedElement mapping = (IdentifiedElement) element;
- String text = mapping.getName();
- EObject container = mapping.eContainer();
- while (container != null && !(container instanceof Group)) {
- text = getLabel(container) + DELIMITER + text;
- container = container.eContainer();
- }
- return text;
- }
- return wrappedProvider != null ? wrappedProvider.getText(element) : super.getText(element);
- }
-
- private String getLabel(final EObject eObject) {
-
- String label = null;
-
- if (eObject instanceof IdentifiedElement) {
- label = new IdentifiedElementQuery((IdentifiedElement) eObject).getLabel();
- } else if (eObject instanceof RepresentationExtensionDescription) {
- label = ((RepresentationExtensionDescription) eObject).getName();
- }
- return label != null ? label : Messages.HierarchyLabelTableProvider_elementWithoutName;
- }
-
-}
diff --git a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/business/internal/dialect/TableDialectUIServices.java b/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/business/internal/dialect/TableDialectUIServices.java
index 2f38a9bc02..dd1dcdba4c 100644
--- a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/business/internal/dialect/TableDialectUIServices.java
+++ b/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/business/internal/dialect/TableDialectUIServices.java
@@ -62,6 +62,7 @@ import org.eclipse.sirius.ui.business.api.dialect.DialectUIServices;
import org.eclipse.sirius.ui.business.api.dialect.ExportFormat;
import org.eclipse.sirius.ui.business.api.dialect.ExportFormat.ExportDocumentFormat;
import org.eclipse.sirius.ui.business.api.session.SessionEditorInput;
+import org.eclipse.sirius.ui.business.internal.dialect.HierarchyLabelProvider;
import org.eclipse.sirius.viewpoint.DRepresentation;
import org.eclipse.sirius.viewpoint.DRepresentationElement;
import org.eclipse.sirius.viewpoint.DSemanticDecorator;
@@ -85,9 +86,7 @@ import com.google.common.collect.Sets;
* @author lredor
*/
public class TableDialectUIServices implements DialectUIServices {
- /**
- * {@inheritDoc}
- */
+
@Override
public IEditorPart openEditor(Session session, DRepresentation dRepresentation, IProgressMonitor monitor) {
IEditorPart editorPart = null;
@@ -137,10 +136,6 @@ public class TableDialectUIServices implements DialectUIServices {
return editorPart;
}
- /**
- *
- * {@inheritDoc}
- */
@Override
public Collection<CommandParameter> provideNewChildDescriptors() {
final Collection<CommandParameter> newChilds = new ArrayList<CommandParameter>();
@@ -149,10 +144,6 @@ public class TableDialectUIServices implements DialectUIServices {
return newChilds;
}
- /**
- *
- * {@inheritDoc}
- */
@Override
public Collection<CommandParameter> provideRepresentationCreationToolDescriptors(final Object feature) {
final Collection<CommandParameter> newChilds = new ArrayList<CommandParameter>();
@@ -162,10 +153,6 @@ public class TableDialectUIServices implements DialectUIServices {
return newChilds;
}
- /**
- *
- * {@inheritDoc}
- */
@Override
public Collection<CommandParameter> provideRepresentationNavigationToolDescriptors(final Object feature) {
final Collection<CommandParameter> newChilds = new ArrayList<CommandParameter>();
@@ -175,10 +162,6 @@ public class TableDialectUIServices implements DialectUIServices {
return newChilds;
}
- /**
- *
- * {@inheritDoc}
- */
@Override
public AdapterFactory createAdapterFactory() {
final ComposedAdapterFactory factory = new ComposedAdapterFactory();
@@ -187,22 +170,11 @@ public class TableDialectUIServices implements DialectUIServices {
return factory;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.ui.business.api.dialect.DialectUIServices#canHandleEditor(org.eclipse.ui.IEditorPart)
- */
@Override
public boolean canHandleEditor(final IEditorPart editorPart) {
return editorPart instanceof AbstractDTableEditor;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.ui.business.api.dialect.DialectUIServices#closeEditor(org.eclipse.ui.IEditorPart,
- * boolean)
- */
@Override
public boolean closeEditor(final IEditorPart editorPart, final boolean save) {
final boolean result = true;
@@ -220,12 +192,6 @@ public class TableDialectUIServices implements DialectUIServices {
return result;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.ui.business.api.dialect.DialectUIServices#isRepresentationManagedByEditor(org.eclipse.sirius.viewpoint.DRepresentation,
- * org.eclipse.ui.IEditorPart)
- */
@Override
public boolean isRepresentationManagedByEditor(final DRepresentation representation, final IEditorPart editorPart) {
boolean isRepresentationManagedByEditor = false;
@@ -238,12 +204,6 @@ public class TableDialectUIServices implements DialectUIServices {
return isRepresentationManagedByEditor;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.ui.business.api.dialect.DialectUIServices#isRepresentationDescriptionManagedByEditor(org.eclipse.sirius.viewpoint.description.RepresentationDescription,
- * org.eclipse.ui.IEditorPart)
- */
@Override
public boolean isRepresentationDescriptionManagedByEditor(final RepresentationDescription representationDescription, final IEditorPart editor) {
if (editor instanceof AbstractDTableEditor) {
@@ -274,31 +234,16 @@ public class TableDialectUIServices implements DialectUIServices {
return representation instanceof TableDescription;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.ui.business.api.dialect.DialectUIServices#canHandle(org.eclipse.sirius.viewpoint.description.RepresentationExtensionDescription)
- * )
- */
@Override
public boolean canHandle(final RepresentationExtensionDescription description) {
return false;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean canExport(ExportFormat format) {
return format.getDocumentFormat().equals(ExportDocumentFormat.CSV);
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.ui.business.api.dialect.DialectUIServices#export(org.eclipse.sirius.viewpoint.DRepresentation,
- * org.eclipse.sirius.business.api.session.Session)
- */
@Override
public void export(final DRepresentation representation, final Session session, final IPath path, final ExportFormat exportFormat, final IProgressMonitor monitor) {
String content = null;
@@ -310,9 +255,6 @@ public class TableDialectUIServices implements DialectUIServices {
}
}
- /**
- * {@inheritDoc}
- */
@Override
public String getEditorName(DRepresentation representation) {
String editorName = representation.getName();
@@ -322,36 +264,22 @@ public class TableDialectUIServices implements DialectUIServices {
return editorName;
}
- /**
- * {@inheritDoc}
- */
@Override
public Collection<CommandParameter> provideTools(EObject context) {
return Lists.newArrayList();
}
- /**
- * {@inheritDoc}
- */
@Override
public Collection<CommandParameter> provideAdditionalMappings(EObject object) {
return Lists.newArrayList();
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.ui.business.api.dialect.DialectUIServices#getHierarchyLabelProvider(ILabelProvider)
- */
@Override
public ILabelProvider getHierarchyLabelProvider(ILabelProvider labelProvider) {
- return new HierarchyLabelTableProvider(labelProvider);
+ return new HierarchyLabelProvider(labelProvider);
}
- /**
- * {@inheritDoc}
- */
@Override
public void setSelection(DialectEditor dialectEditor, List<DRepresentationElement> selection) {
if (dialectEditor instanceof DTableEditor && dialectEditor instanceof IViewerProvider) {
@@ -368,11 +296,6 @@ public class TableDialectUIServices implements DialectUIServices {
setSelection(dialectEditor, selection);
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.ui.business.api.dialect.DialectUIServices#getSelection(org.eclipse.sirius.ui.business.api.dialect.DialectEditor)
- */
@Override
public Collection<DSemanticDecorator> getSelection(DialectEditor editor) {
Collection<DSemanticDecorator> selection = Sets.newLinkedHashSet();
@@ -388,12 +311,6 @@ public class TableDialectUIServices implements DialectUIServices {
return selection;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.ui.business.api.dialect.DialectUIServices#completeToolTipText(String,
- * EObject, EStructuralFeature)
- */
@Override
public String completeToolTipText(String toolTipText, EObject eObject, EStructuralFeature feature) {
return toolTipText;

Back to the top