Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 406b9a9fc428a95a8c2d9b36a560b570c9e3d5d1 (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
package org.eclipse.papyrus.plugin.management.helper;

import java.io.IOException;

import javax.xml.parsers.ParserConfigurationException;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.papyrus.eclipse.project.editors.interfaces.IFeatureProjectEditor;
import org.eclipse.papyrus.eclipse.project.editors.project.FeatureProjectEditor;
import org.xml.sax.SAXException;


public class FeatureManagementHelper extends AbstractProjectManagementHelper{


	public static final String EPL_HTML_SOURCE_PATH = "/resources/epl-v10.html.file";

	public static final String EPL_HTML_PATH = "epl-v10.html";

	public static final String LICENCE_SOURCE_HTML_PATH = "/resources/license.html.file";

	public static final String LICENCE_HTML_PATH = "license.html";


	public FeatureManagementHelper(final String version, final String provider, final boolean testMarkIncubation) {
		super("org.eclipse.pde.FeatureNature", version, provider, testMarkIncubation);
	}

	@Override
	protected void handleProject(IProject project) throws CoreException, IOException, Throwable {
		checkFile(project, EPL_HTML_SOURCE_PATH, EPL_HTML_PATH);
		checkFile(project, LICENCE_SOURCE_HTML_PATH, LICENCE_HTML_PATH);
		checkIncubation(project);
		setDescription(project);
	}

	@Override
	protected void checkIncubation(IProject project) throws Throwable {
		IFeatureProjectEditor editor = getFeatureEditor(project);
		String label = editor.getLabel();
//		if(!label.endsWith(INCUBATION)){
			label = askNewName(label);
			editor.setLabel(label);
			
		
			
			((FeatureProjectEditor)editor).save();
//		}
	
		
	}
	
	protected IFeatureProjectEditor getFeatureEditor(final IProject project) throws ParserConfigurationException, SAXException, IOException, CoreException{
		FeatureProjectEditor editor = new FeatureProjectEditor(project);
		editor.init();
		return editor;
	}
	
	protected void setDescription(final IProject project) throws Throwable{
		IFeatureProjectEditor editor = getFeatureEditor(project);
		editor.setCopyright("http://www.google.fr/myOwnURLNicest", "ma description perso");
		((FeatureProjectEditor)editor).save();
	}
}

Back to the top