1 /*******************************************************************************
2  *  Copyright (c) 2005, 2019 IBM Corporation and others.
3  *
4  *  This program and the accompanying materials
5  *  are made available under the terms of the Eclipse Public License 2.0
6  *  which accompanies this distribution, and is available at
7  *  https://www.eclipse.org/legal/epl-2.0/
8  *
9  *  SPDX-License-Identifier: EPL-2.0
10  *
11  *  Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.pde.internal.ui.correction;
15 
16 import org.eclipse.core.resources.IMarker;
17 import org.eclipse.core.runtime.CoreException;
18 import org.eclipse.osgi.util.NLS;
19 import org.eclipse.pde.internal.core.builders.PDEMarkerFactory;
20 import org.eclipse.pde.internal.core.text.build.Build;
21 import org.eclipse.pde.internal.core.text.build.BuildEntry;
22 import org.eclipse.pde.internal.ui.PDEUIMessages;
23 
24 public class RemoveSeperatorBuildEntryResolution extends BuildEntryMarkerResolution {
25 
RemoveSeperatorBuildEntryResolution(int type, IMarker marker)26 	public RemoveSeperatorBuildEntryResolution(int type, IMarker marker) {
27 		super(type, marker);
28 	}
29 
30 	@Override
createChange(Build build)31 	protected void createChange(Build build) {
32 		try {
33 			fEntry = (String) marker.getAttribute(PDEMarkerFactory.BK_BUILD_ENTRY);
34 			fToken = (String) marker.getAttribute(PDEMarkerFactory.BK_BUILD_TOKEN);
35 		} catch (CoreException e) {
36 		}
37 		try {
38 			BuildEntry buildEntry = (BuildEntry) build.getEntry(fEntry);
39 			buildEntry.renameToken(fToken, fToken.substring(0, fToken.length() - 1));
40 		} catch (CoreException e) {
41 		}
42 	}
43 
44 	@Override
getLabel()45 	public String getLabel() {
46 		return NLS.bind(PDEUIMessages.RemoveSeperatorBuildEntryResolution_label, fToken, fEntry);
47 	}
48 
49 }
50