/**
 * Copyright (c) 2010 committers of YAKINDU and others.
 * 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:
 * 	committers of YAKINDU - initial API and implementation
 * 
 */
package org.yakindu.sct.statechart.diagram.editor;

import org.eclipse.gef.Tool;
import org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory;
import org.eclipse.gmf.runtime.diagram.ui.tools.ConnectionCreationTool;
import org.eclipse.gmf.runtime.diagram.ui.tools.CreationTool;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.swt.SWT;

/**
 * 
 * @author muelder
 * 
 */
public class StatechartDiagramPaletteFactory extends PaletteFactory.Adapter {

	@Override
	public Tool createTool(String toolId) {
		IElementType elementType = StatechartElementTypes
				.fromSemanticId(toolId);
		if (elementType == null)
			throw new IllegalStateException("No Tool for toolId " + toolId
					+ " found!");
		if (toolId.equals("Transition")) {
			return new ConnectionCreationTool(elementType){
				//https://bugs.eclipse.org/bugs/show_bug.cgi?id=341893
				protected void handleFinished() {
			        if (!getCurrentInput().isModKeyDown(SWT.MOD1)) {
			            super.handleFinished();
			        } else {
			            reactivate();
			        }
			    }
			};
		} else
			return new CreationTool(elementType) {
			//https://bugs.eclipse.org/bugs/show_bug.cgi?id=341893
			protected void handleFinished() {
		        if (!getCurrentInput().isModKeyDown(SWT.MOD1)) {
		            super.handleFinished();
		        } else {
		            reactivate();
		        }
		    }
		};
	}

}

@@ -752,37 +752,8 @@
 pe;%0D
-%0Aimport org.eclipse.swt.SWT;%0D
 %0A%0D%0A/
@@ -1215,624 +1215,66 @@
 ype)
-%7B%0D%0A%09%09%09%09//https://bugs.eclipse.org/bugs/show_bug.cgi?id=341893%0D%0A%09%09%09%09protected void handleFinished() %7B%0D%0A%09%09%09        if (!getCurrentInput().isModKeyDown(SWT.MOD1)) %7B%0D%0A%09%09%09            super.handleFinished();%0D%0A%09%09%09        %7D else %7B%0D%0A%09%09%09            reactivate();%0D%0A%09%09%09        %7D%0D%0A%09%09%09    %7D%0D%0A%09%09%09%7D;%0D%0A%09%09%7D else%0D%0A%09%09%09return new CreationTool(elementType) %7B%0D%0A%09%09%09//https://bugs.eclipse.org/bugs/show_bug.cgi?id=341893%0D%0A%09%09%09protected void handleFinished() %7B%0D%0A%09%09        if (!getCurrentInput().isModKeyDown(SWT.MOD1)) %7B%0D%0A%09%09            super.handleFinished();%0D%0A%09%09        %7D else %7B%0D%0A%09%09            reactivate();%0D%0A%09%09        %7D%0D%0A%09%09    %7D%0D%0A%09%09%7D
+;%0D%0A%09%09%7D else%0D%0A%09%09%09return new CreationTool(elementType)
 ;%0D%0A%09%7D%0D%0A
-%0D%0A
 %7D%0D%0A

Patch for https://bugs.eclipse.org/bugs/show_bug.cgi?id=341893 removed