blob: deef06bcf78b354391a40fb26c51c40d0f2a4a3f [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.sirius.table.editor.properties.sections.description.linemapping;
// Start of user code imports
import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.sirius.editor.properties.sections.common.AbstractEditorDialogPropertySection;
import org.eclipse.sirius.table.metamodel.table.description.DescriptionPackage;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
// End of user code imports
/**
* A section for the reusedSubLines property of a LineMapping object.
*/
public class LineMappingReusedSubLinesPropertySection extends AbstractEditorDialogPropertySection {
/**
* @see org.eclipse.sirius.table.editor.properties.sections.AbstractEditorDialogPropertySection#getDefaultLabelText()
*/
@Override
protected String getDefaultLabelText() {
return "ReusedSubLines"; //$NON-NLS-1$
}
/**
* @see org.eclipse.sirius.table.editor.properties.sections.AbstractEditorDialogPropertySection#getLabelText()
*/
@Override
protected String getLabelText() {
String labelText;
labelText = super.getLabelText() + ":"; //$NON-NLS-1$
// Start of user code get label text
// End of user code get label text
return labelText;
}
/**
* @see org.eclipse.sirius.table.editor.properties.sections.AbstractEditorDialogPropertySection#getFeature()
*/
@Override
protected EReference getFeature() {
return DescriptionPackage.eINSTANCE.getLineMapping_ReusedSubLines();
}
/**
* @see org.eclipse.sirius.table.editor.properties.sections.AbstractEditorDialogPropertySection#getFeatureAsText()
*/
@Override
protected String getFeatureAsText() {
String string = new String();
if (eObject.eGet(getFeature()) != null) {
List<?> values = (List<?>) eObject.eGet(getFeature());
for (Iterator<?> iterator = values.iterator(); iterator.hasNext();) {
EObject eObj = (EObject) iterator.next();
string += getAdapterFactoryLabelProvider(eObj).getText(eObj);
if (iterator.hasNext()) {
string += ", ";
}
}
}
return string;
}
/**
* @see org.eclipse.sirius.table.editor.properties.sections.AbstractEditorDialogPropertySection#isEqual(java.util.List)
*/
@Override
protected boolean isEqual(List<?> newList) {
return newList.equals(eObject.eGet(getFeature()));
}
/**
* {@inheritDoc}
*/
@Override
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
super.createControls(parent, tabbedPropertySheetPage);
// Start of user code create controls
// End of user code create controls
}
// Start of user code user operations
// End of user code user operations
}