1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

Merge remote-tracking branch 'cdt/master' into sd90

This commit is contained in:
Andrew Gvozdev 2012-09-05 16:16:18 -04:00
commit 14257178d0
4 changed files with 33 additions and 46 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2011 IBM Corporation and others.
* Copyright (c) 2003, 2012 IBM Corporation 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
@ -72,7 +72,6 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.Window;
import org.eclipse.osgi.util.TextProcessor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@ -279,8 +278,8 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
if (applicabilityCalculator == null || applicabilityCalculator.isOptionVisible(config, holder, opt)) {
String optId = getToolSettingsPrefStore().getOptionId(opt);
final String nameStr = TextProcessor.process(opt.getName());
String tipStr = TextProcessor.process(opt.getToolTip());
final String nameStr = opt.getName();
String tipStr = opt.getToolTip();
String contextId = opt.getContextId();
if (pageHasToolTipBox && (tipStr==null || tipStr.trim().length()==0)) {
@ -923,7 +922,7 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
IHoldsOptions holder = (IHoldsOptions)options[index][0];
if (holder == null) break; // The array may not be full
IOption opt = (IOption)options[index][1];
String tipStr = TextProcessor.process(opt.getToolTip());
String tipStr = opt.getToolTip();
// check to see if the option has an applicability calculator
IOptionApplicability applicabilityCalculator = opt.getApplicabilityCalculator();

View file

@ -235,7 +235,7 @@ public class EFSExtensionTests extends TestCase {
String path = EFSExtensionManager.getDefault().getMappedPath(originalURI);
assertEquals(path, "/c:/foo");
assertEquals(path, "c:/foo");
}
public void testGetPathFromURI() {
@ -248,7 +248,7 @@ public class EFSExtensionTests extends TestCase {
String path = EFSExtensionManager.getDefault().getMappedPath(originalURI);
assertEquals(path, "/c:/foo");
assertEquals(path, "c:/foo");
}
public void testExtension() {

View file

@ -13,7 +13,9 @@ package org.eclipse.cdt.core;
import java.net.URI;
import java.net.URISyntaxException;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.URIUtil;
/**
@ -54,7 +56,15 @@ public abstract class EFSExtensionProvider {
* physical file.
*/
public String getPathFromURI(URI locationURI) {
return locationURI.getPath();
String path = locationURI.getPath();
String schema = locationURI.getScheme();
if (schema != null && schema.equals(EFS.SCHEME_FILE) && Platform.getOS().equals(Platform.WS_WIN32)) {
// URI path on Windows is represented as "/C:/path"
if (path != null && path.matches("/[A-Za-z]:.*")) { //$NON-NLS-1$
path = path.substring(1);
}
}
return path;
}
/**
@ -91,7 +101,7 @@ public abstract class EFSExtensionProvider {
final int length = pathString.length();
StringBuffer pathBuf = new StringBuffer(length + 1);
// force the path to be absolute
// force the path to be absolute including Windows where URI path is represented as "/C:/path"
if (length > 0 && (pathString.charAt(0) != '/')) {
pathBuf.append('/');
}

View file

@ -71,7 +71,7 @@ public class ErrorParserManager extends OutputStream implements IConsoleParser,
* @since 5.4
*/
public static final String BUILD_CONTEXT = "build"; //$NON-NLS-1$
private int nOpens;
private int lineCounter=0;
@ -221,16 +221,7 @@ public class ErrorParserManager extends OutputStream implements IConsoleParser,
*/
public void pushDirectory(IPath dir) {
if (dir != null) {
URI uri;
URI workingDirectoryURI = getWorkingDirectoryURI();
if (!dir.isAbsolute()) {
uri = URIUtil.append(workingDirectoryURI, dir.toString());
} else {
uri = toURI(dir);
if (uri == null) {
return;
}
}
URI uri = toURI(dir);
pushDirectoryURI(uri);
}
}
@ -485,18 +476,9 @@ outer:
* @return - file in the workspace or {@code null} if such a file doesn't exist
*/
protected IFile findFileInWorkspace(IPath path) {
URI uri;
if (!path.isAbsolute()) {
URI workingDirectoryURI = getWorkingDirectoryURI();
uri = EFSExtensionManager.getDefault().append(workingDirectoryURI, path.toString());
}
else {
uri = toURI(path);
if (uri == null) {
return null;
}
}
return findFileInWorkspace(uri);
URI uri = toURI(path);
IFile file = findFileInWorkspace(uri);
return file;
}
/**
@ -728,10 +710,7 @@ outer:
}
/**
* Converts a location {@link IPath} to an {@link URI}. Contrary to
* {@link URIUtil#toURI(IPath)} this method does not assume that the path belongs
* to local file system.
*
* Converts a location {@link IPath} to an {@link URI}.
* The returned URI uses the scheme and authority of the current working directory
* as returned by {@link #getWorkingDirectoryURI()}
*
@ -740,16 +719,15 @@ outer:
* @since 5.1
*/
private URI toURI(IPath path) {
// try {
URI baseURI = getWorkingDirectoryURI();
String uriString = path.toString();
URI uri = null;
URI workingDirectoryURI = getWorkingDirectoryURI();
if (path.isAbsolute()) {
uri = EFSExtensionManager.getDefault().createNewURIFromPath(workingDirectoryURI, path.toString());
} else {
uri = EFSExtensionManager.getDefault().append(workingDirectoryURI, path.toString());
}
// On Windows "C:/folder/" -> "/C:/folder/"
if (path.isAbsolute() && uriString.charAt(0) != IPath.SEPARATOR) {
uriString = IPath.SEPARATOR + uriString;
}
return EFSExtensionManager.getDefault().createNewURIFromPath(baseURI, uriString);
return uri;
}
/**
@ -828,7 +806,7 @@ outer:
public static String[] getErrorParserAvailableIdsInContext(String context) {
return ErrorParserExtensionManager.getErrorParserAvailableIdsInContext(context);
}
/**
* @return IDs of error parsers contributed through error parser extension point.
* @since 5.2