<commit_before>package org.camunda.bpm.modeler.core.features;

import org.camunda.bpm.modeler.core.features.activity.AbstractAddActivityFeature;
import org.camunda.bpm.modeler.core.features.api.IDecorateContext;
import org.camunda.bpm.modeler.core.features.api.IDecorateFeature;
import org.camunda.bpm.modeler.core.utils.BusinessObjectUtil;
import org.camunda.bpm.modeler.core.utils.FeatureSupport;
import org.camunda.bpm.modeler.core.utils.StyleUtil;
import org.eclipse.bpmn2.BaseElement;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
import org.eclipse.graphiti.mm.pictograms.ContainerShape;
import org.eclipse.graphiti.mm.pictograms.PictogramElement;
import org.eclipse.graphiti.mm.pictograms.Shape;

/**
 * A {@link IDecorateFeature} implementation that allows the decoration of a
 * well defined decorate container that is a child shape of the candidate to be
 * decorated.
 * 
 * Subclasses may override {@link #decorate(GraphicsAlgorithm)} or {@link #decorate(Shape, GraphicsAlgorithm)}
 * to perform decoration.
 * 
 * @author nico.rehwaldt
 *
 * @param <T> the type of graphics algorithm that is the container decorated by this feature
 * 
 * @see #getDecorateContainer(ContainerShape)
 * @see #decorate(IDecorateContext)
 */
public class AbstractFlowElementDecorateFeature<T extends GraphicsAlgorithm> extends DefaultBpmn2DecorateFeature {

	public AbstractFlowElementDecorateFeature(IFeatureProvider fp) {
		super(fp);
	}

	@Override
	public void decorate(IDecorateContext context) {
		super.decorate(context);
		
		PictogramElement pictogramElement = context.getPictogramElement();
		
		if (pictogramElement instanceof ContainerShape) {

			ContainerShape shape = (ContainerShape) pictogramElement;
			
			T decorateContainer = getDecorateContainer(shape);
			
			clearDecorations(decorateContainer);
			
			decorate(shape, decorateContainer);
		} else {
			System.out.println("Not decorating " + pictogramElement);
		}
	}

	private void clearDecorations(T decorateContainer) {
		decorateContainer.getGraphicsAlgorithmChildren().clear();
	}

	/**
	 * Decorates the given decoration container within the decoration candidate.
	 * 
	 * @param shape
	 * @param decorateContainer
	 */
	protected void decorate(Shape shape, T decorateContainer) {
		
		// per default, perform the default decoration
		// via style util
		BaseElement businessObject = BusinessObjectUtil.getFirstBaseElement(shape);<commit_msg>fix(decorateFeature): reset line width to 1px<commit_after>package org.camunda.bpm.modeler.core.features;

import org.camunda.bpm.modeler.core.features.activity.AbstractAddActivityFeature;
import org.camunda.bpm.modeler.core.features.api.IDecorateContext;
import org.camunda.bpm.modeler.core.features.api.IDecorateFeature;
import org.camunda.bpm.modeler.core.utils.BusinessObjectUtil;
import org.camunda.bpm.modeler.core.utils.FeatureSupport;
import org.camunda.bpm.modeler.core.utils.StyleUtil;
import org.eclipse.bpmn2.BaseElement;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
import org.eclipse.graphiti.mm.pictograms.ContainerShape;
import org.eclipse.graphiti.mm.pictograms.PictogramElement;
import org.eclipse.graphiti.mm.pictograms.Shape;

/**
 * A {@link IDecorateFeature} implementation that allows the decoration of a
 * well defined decorate container that is a child shape of the candidate to be
 * decorated.
 * 
 * Subclasses may override {@link #decorate(GraphicsAlgorithm)} or {@link #decorate(Shape, GraphicsAlgorithm)}
 * to perform decoration.
 * 
 * @author nico.rehwaldt
 *
 * @param <T> the type of graphics algorithm that is the container decorated by this feature
 * 
 * @see #getDecorateContainer(ContainerShape)
 * @see #decorate(IDecorateContext)
 */
public class AbstractFlowElementDecorateFeature<T extends GraphicsAlgorithm> extends DefaultBpmn2DecorateFeature {

	public AbstractFlowElementDecorateFeature(IFeatureProvider fp) {
		super(fp);
	}

	@Override
	public void decorate(IDecorateContext context) {
		super.decorate(context);
		
		PictogramElement pictogramElement = context.getPictogramElement();
		
		if (pictogramElement instanceof ContainerShape) {

			ContainerShape shape = (ContainerShape) pictogramElement;
			
			T decorateContainer = getDecorateContainer(shape);
			
			clearDecorations(decorateContainer);
			
			decorate(shape, decorateContainer);
		} else {
			System.out.println("Not decorating " + pictogramElement);
		}
	}

	private void clearDecorations(T decorateContainer) {
		decorateContainer.setLineWidth(1);
		decorateContainer.getGraphicsAlgorithmChildren().clear();
	}

	/**
	 * Decorates the given decoration container within the decoration candidate.
	 * 
	 * @param shape
	 * @param decorateContainer
	 */
	protected void decorate(Shape shape, T decorateContainer) {
		
		// per default, perform the default decoration
		// via style util
		BaseElement businessObject = BusinessObjectUtil.getFirstBaseElement(shape);
{'fraction_non_alphanumeric': 0.0910895018852947, 'fraction_numerical': 0.0011907124429450288, 'mean_word_length': 5.412213740458015, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5634065', 'n_tokens_mistral': 1582, 'n_tokens_neox': 1433, 'n_words': 321}