Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: ba3efab8074ad518b7da77f283a03fdfc88c6db5 (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
/*****************************************************************************
 * Copyright (c) 2014, 2015 CEA LIST, Christian W. Damus, 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:
 *  Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
 *  Christian W. Damus - Support updating of multiple selected files
 *****************************************************************************/
package org.eclipse.papyrus.releng.tools.internal.popup.actions;

import org.eclipse.core.resources.IFile;
import org.w3c.dom.Node;


public class PomPropertiesUpdater extends DependencyUpdater {

	public PomPropertiesUpdater() {
		super();
	}

	@Override
	public boolean canUpdate(IFile file) {
		return "xml".equals(file.getFileExtension()) && file.getName().contains("pom"); //$NON-NLS-1$ //$NON-NLS-2$
	}

	@Override
	protected String getXpath() {
		return "/project/properties/*[substring(name(), string-length(name()) - 8) = '.repo.url']"; //$NON-NLS-1$
	}

	@Override
	protected String getCurrentLocation(Node uri) {
		return uri.getTextContent();
	}

	@Override
	protected void updateUri(Node uri, String location) {
		if (location.startsWith("http://download.eclipse.org")) {
			location = location.replace("http://download.eclipse.org", "${eclipse.download}");
		}
		uri.setTextContent(location);
	}

}

Back to the top