Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d5dbefd72a31e5fceaf6d211481d10b42edbab89 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*******************************************************************************
 * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 * 
 * CONTRIBUTORS:
 * 		Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
 * 
 *******************************************************************************/

package org.eclipse.etrice.generator.launch.c;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.etrice.generator.launch.GeneratorConfigTab;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;

/**
 * @author Henrik Rentz-Reichert
 *
 */
public class CGeneratorConfigTab extends GeneratorConfigTab {
	
	public static final String GEN_CPP_FILE_EXTENSIONS = "cppFileExtensions";
	
	private Button generateCppFileExtensions;

	@Override
	protected void addFurtherControls(Composite mainComposite) {
		super.addFurtherControls(mainComposite);
		

		createSeparator(mainComposite, 2);
		
		generateCppFileExtensions = createCheckButton(mainComposite, "generate with C++ file extensions");
		generateCppFileExtensions.setToolTipText("this options generates C source and header files with *.cpp and *.hpp extensions");
		generateCppFileExtensions.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1));
		generateCppFileExtensions.addSelectionListener(new UpdateConfig());
	}
	
	@Override
	public void initializeFrom(ILaunchConfiguration configuration) {
		super.initializeFrom(configuration);
		
		try {
			generateCppFileExtensions.setSelection(configuration.getAttribute(GEN_CPP_FILE_EXTENSIONS, false));
		} catch (CoreException e) {
			e.printStackTrace();
		}
	}
	
	@Override
	public void performApply(ILaunchConfigurationWorkingCopy configuration) {
		super.performApply(configuration);
		
		configuration.setAttribute(GEN_CPP_FILE_EXTENSIONS, generateCppFileExtensions.getSelection());
	}
	
	/* (non-Javadoc)
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
	 */
	@Override
	public String getName() {
		return "C Generator";
	}
}

Back to the top