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:
commit
14257178d0
4 changed files with 33 additions and 46 deletions
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* 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.TreeViewer;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.jface.window.Window;
|
import org.eclipse.jface.window.Window;
|
||||||
import org.eclipse.osgi.util.TextProcessor;
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.ModifyEvent;
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
import org.eclipse.swt.events.ModifyListener;
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
|
@ -279,8 +278,8 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
||||||
if (applicabilityCalculator == null || applicabilityCalculator.isOptionVisible(config, holder, opt)) {
|
if (applicabilityCalculator == null || applicabilityCalculator.isOptionVisible(config, holder, opt)) {
|
||||||
|
|
||||||
String optId = getToolSettingsPrefStore().getOptionId(opt);
|
String optId = getToolSettingsPrefStore().getOptionId(opt);
|
||||||
final String nameStr = TextProcessor.process(opt.getName());
|
final String nameStr = opt.getName();
|
||||||
String tipStr = TextProcessor.process(opt.getToolTip());
|
String tipStr = opt.getToolTip();
|
||||||
String contextId = opt.getContextId();
|
String contextId = opt.getContextId();
|
||||||
|
|
||||||
if (pageHasToolTipBox && (tipStr==null || tipStr.trim().length()==0)) {
|
if (pageHasToolTipBox && (tipStr==null || tipStr.trim().length()==0)) {
|
||||||
|
@ -923,7 +922,7 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
||||||
IHoldsOptions holder = (IHoldsOptions)options[index][0];
|
IHoldsOptions holder = (IHoldsOptions)options[index][0];
|
||||||
if (holder == null) break; // The array may not be full
|
if (holder == null) break; // The array may not be full
|
||||||
IOption opt = (IOption)options[index][1];
|
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
|
// check to see if the option has an applicability calculator
|
||||||
IOptionApplicability applicabilityCalculator = opt.getApplicabilityCalculator();
|
IOptionApplicability applicabilityCalculator = opt.getApplicabilityCalculator();
|
||||||
|
|
|
@ -235,7 +235,7 @@ public class EFSExtensionTests extends TestCase {
|
||||||
|
|
||||||
String path = EFSExtensionManager.getDefault().getMappedPath(originalURI);
|
String path = EFSExtensionManager.getDefault().getMappedPath(originalURI);
|
||||||
|
|
||||||
assertEquals(path, "/c:/foo");
|
assertEquals(path, "c:/foo");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetPathFromURI() {
|
public void testGetPathFromURI() {
|
||||||
|
@ -248,7 +248,7 @@ public class EFSExtensionTests extends TestCase {
|
||||||
|
|
||||||
String path = EFSExtensionManager.getDefault().getMappedPath(originalURI);
|
String path = EFSExtensionManager.getDefault().getMappedPath(originalURI);
|
||||||
|
|
||||||
assertEquals(path, "/c:/foo");
|
assertEquals(path, "c:/foo");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExtension() {
|
public void testExtension() {
|
||||||
|
|
|
@ -13,7 +13,9 @@ package org.eclipse.cdt.core;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
|
import org.eclipse.core.filesystem.EFS;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.URIUtil;
|
import org.eclipse.core.runtime.URIUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,7 +56,15 @@ public abstract class EFSExtensionProvider {
|
||||||
* physical file.
|
* physical file.
|
||||||
*/
|
*/
|
||||||
public String getPathFromURI(URI locationURI) {
|
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();
|
final int length = pathString.length();
|
||||||
StringBuffer pathBuf = new StringBuffer(length + 1);
|
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) != '/')) {
|
if (length > 0 && (pathString.charAt(0) != '/')) {
|
||||||
pathBuf.append('/');
|
pathBuf.append('/');
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,16 +221,7 @@ public class ErrorParserManager extends OutputStream implements IConsoleParser,
|
||||||
*/
|
*/
|
||||||
public void pushDirectory(IPath dir) {
|
public void pushDirectory(IPath dir) {
|
||||||
if (dir != null) {
|
if (dir != null) {
|
||||||
URI uri;
|
URI uri = toURI(dir);
|
||||||
URI workingDirectoryURI = getWorkingDirectoryURI();
|
|
||||||
if (!dir.isAbsolute()) {
|
|
||||||
uri = URIUtil.append(workingDirectoryURI, dir.toString());
|
|
||||||
} else {
|
|
||||||
uri = toURI(dir);
|
|
||||||
if (uri == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pushDirectoryURI(uri);
|
pushDirectoryURI(uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -485,18 +476,9 @@ outer:
|
||||||
* @return - file in the workspace or {@code null} if such a file doesn't exist
|
* @return - file in the workspace or {@code null} if such a file doesn't exist
|
||||||
*/
|
*/
|
||||||
protected IFile findFileInWorkspace(IPath path) {
|
protected IFile findFileInWorkspace(IPath path) {
|
||||||
URI uri;
|
URI uri = toURI(path);
|
||||||
if (!path.isAbsolute()) {
|
IFile file = findFileInWorkspace(uri);
|
||||||
URI workingDirectoryURI = getWorkingDirectoryURI();
|
return file;
|
||||||
uri = EFSExtensionManager.getDefault().append(workingDirectoryURI, path.toString());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
uri = toURI(path);
|
|
||||||
if (uri == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return findFileInWorkspace(uri);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -728,10 +710,7 @@ outer:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a location {@link IPath} to an {@link URI}. Contrary to
|
* Converts a location {@link IPath} to an {@link URI}.
|
||||||
* {@link URIUtil#toURI(IPath)} this method does not assume that the path belongs
|
|
||||||
* to local file system.
|
|
||||||
*
|
|
||||||
* The returned URI uses the scheme and authority of the current working directory
|
* The returned URI uses the scheme and authority of the current working directory
|
||||||
* as returned by {@link #getWorkingDirectoryURI()}
|
* as returned by {@link #getWorkingDirectoryURI()}
|
||||||
*
|
*
|
||||||
|
@ -740,16 +719,15 @@ outer:
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
private URI toURI(IPath path) {
|
private URI toURI(IPath path) {
|
||||||
// try {
|
URI uri = null;
|
||||||
URI baseURI = getWorkingDirectoryURI();
|
URI workingDirectoryURI = getWorkingDirectoryURI();
|
||||||
String uriString = path.toString();
|
if (path.isAbsolute()) {
|
||||||
|
uri = EFSExtensionManager.getDefault().createNewURIFromPath(workingDirectoryURI, path.toString());
|
||||||
// On Windows "C:/folder/" -> "/C:/folder/"
|
} else {
|
||||||
if (path.isAbsolute() && uriString.charAt(0) != IPath.SEPARATOR) {
|
uri = EFSExtensionManager.getDefault().append(workingDirectoryURI, path.toString());
|
||||||
uriString = IPath.SEPARATOR + uriString;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFSExtensionManager.getDefault().createNewURIFromPath(baseURI, uriString);
|
return uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue