# HG changeset patch # User timkelly # Date 1284739900 18000 # Node ID 65dabfc851929c998eb8913a90179aa415d9f627 # Parent 53f8b3193295f03e5998ef4ef5d1ff76db80b026# Parent 250d6109c006de0dae6ec9ffb75fe390b8ece594 merge commit diff -r 53f8b3193295 -r 65dabfc85192 builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/BuildPKGCommandHandler.java --- a/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/BuildPKGCommandHandler.java Fri Sep 17 11:10:59 2010 -0500 +++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/BuildPKGCommandHandler.java Fri Sep 17 11:11:40 2010 -0500 @@ -48,9 +48,7 @@ import com.nokia.carbide.cdt.builder.builder.CarbideCommandLauncher; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; -import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; import com.nokia.carbide.cpp.internal.builder.utils.Activator; -import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; public class BuildPKGCommandHandler extends AbstractHandler { @@ -151,14 +149,11 @@ IPath workingDir = cpi.getINFWorkingDirectory(); CarbideCommandLauncher bldMakeLauncher = new CarbideCommandLauncher(project, monitor, CarbideCPPBuilder.getParserIdArray(ICarbideBuildConfiguration.ERROR_PARSERS_SIS_BUILDER), workingDir); bldMakeLauncher.showCommand(true); - String defaultConfigName = cpi.getDefaultBuildConfigName(); ICarbideBuildConfiguration defaultConfig = cpi.getDefaultConfiguration(); - // TODO: YUCKY!!! - ISymbianBuildContext context = BuildContextSBSv1.getBuildContextFromDisplayName(defaultConfigName); bldMakeLauncher.startTimingStats(); - bldMakeLauncher.writeToConsole("\n***Building \"" + finalComponentName + "\" for project \"" + projectName + "\" and configuration \"" + context.getDisplayString() + "\".\n"); + bldMakeLauncher.writeToConsole("\n***Building \"" + finalComponentName + "\" for project \"" + projectName + "\" and configuration \"" + defaultConfig.getDisplayString() + "\".\n"); CarbideCPPBuilder.invokeSISBuilder(finalPKGPath, defaultConfig, bldMakeLauncher, subMonitor, false); bldMakeLauncher.writeToConsole(bldMakeLauncher.getTimingStats()); diff -r 53f8b3193295 -r 65dabfc85192 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ConnectionUIUtils.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ConnectionUIUtils.java Fri Sep 17 11:10:59 2010 -0500 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ConnectionUIUtils.java Fri Sep 17 11:11:40 2010 -0500 @@ -20,16 +20,15 @@ import java.util.Collection; import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.JFaceColors; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Display; import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; import com.nokia.carbide.remoteconnections.interfaces.IConnectedService; -import com.nokia.carbide.remoteconnections.interfaces.IConnection; import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus; import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus.EStatus; +import com.nokia.carbide.remoteconnections.interfaces.IConnection; import com.nokia.carbide.remoteconnections.internal.api.IConnection2; import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus; import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus.EConnectionStatus; @@ -77,7 +76,6 @@ public static final Color COLOR_GREEN = new Color(Display.getDefault(), 0, 128, 0); public static final Color COLOR_ELECTRIC = new Color(Display.getDefault(), 0, 0, 255); public static final Color COLOR_GREY = new Color(Display.getDefault(), 96, 96, 96); - public static final Color COLOR_HYPERLINK = JFaceColors.getHyperlinkText(Display.getDefault()); /** * Get the image representing the connection status. diff -r 53f8b3193295 -r 65dabfc85192 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java Fri Sep 17 11:10:59 2010 -0500 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java Fri Sep 17 11:11:40 2010 -0500 @@ -48,6 +48,7 @@ import org.eclipse.jface.viewers.ListViewer; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StyledString; import org.eclipse.jface.viewers.TreeNode; import org.eclipse.jface.viewers.TreeNodeContentProvider; import org.eclipse.jface.viewers.TreeViewer; @@ -111,6 +112,8 @@ import com.nokia.cpp.internal.api.utils.core.ObjectUtils; import com.nokia.cpp.internal.api.utils.core.Pair; import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; +import com.nokia.cpp.internal.api.utils.ui.LinkParser; +import com.nokia.cpp.internal.api.utils.ui.LinkParser.Element; public class ConnectionSettingsPage extends WizardPage implements ISettingsChangedListener { @@ -802,8 +805,15 @@ public void statusChanged(final IStatus status) { Display.getDefault().asyncExec(new Runnable() { public void run() { - if (!statusText.isDisposed()) - statusText.setText(status.getLongDescription()); + if (!statusText.isDisposed()) { + String longDescription = status.getLongDescription(); + if (longDescription != null) { + List elements = LinkParser.parseText(longDescription); + StyledString styledString = LinkParser.getStyledString(elements); + longDescription = styledString.getString(); + } + statusText.setText(longDescription); + } if (status.getEStatus().equals(EStatus.UP)) resetServiceTesting(false); } diff -r 53f8b3193295 -r 65dabfc85192 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/view/DescriptionLabelProvider.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/view/DescriptionLabelProvider.java Fri Sep 17 11:10:59 2010 -0500 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/view/DescriptionLabelProvider.java Fri Sep 17 11:11:40 2010 -0500 @@ -2,15 +2,11 @@ import java.net.MalformedURLException; import java.net.URL; -import java.util.ArrayList; import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.viewers.StyledCellLabelProvider; import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.StyledString.Styler; import org.eclipse.jface.viewers.TreeNode; import org.eclipse.jface.viewers.TreeViewerColumn; import org.eclipse.jface.viewers.ViewerCell; @@ -19,7 +15,6 @@ import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.TextStyle; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; @@ -36,41 +31,16 @@ import com.nokia.carbide.remoteconnections.internal.ui.ConnectionUIUtils; import com.nokia.carbide.remoteconnections.settings.ui.SettingsWizard; import com.nokia.cpp.internal.api.utils.core.TextUtils; +import com.nokia.cpp.internal.api.utils.ui.LinkParser; import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; +import com.nokia.cpp.internal.api.utils.ui.LinkParser.Element; +import com.nokia.cpp.internal.api.utils.ui.LinkParser.LinkElement; public class DescriptionLabelProvider extends StyledCellLabelProvider { - private class Element { - private String text; - - public Element(String text) { - this.text = text; - } - - public String getText() { - return text; - } - } - - private class LinkElement extends Element { - private String href; - - public LinkElement(String href, String text) { - super(text); - this.href = href; - } - - public String getHref() { - return href; - } - } - - private static final Pattern HREF_PATTERN = - Pattern.compile("(.*?)", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$ private static final String AGENT_INSTALLERS_URL = "about:agentInstallers"; //$NON-NLS-1$ private final ConnectionsView connectionsView; - private Styler hyperLinkStyler; private TreeViewerColumn treeViewerColumn; private Listener mouseListener; @@ -78,13 +48,6 @@ this.connectionsView = connectionsView; this.treeViewerColumn = treeViewerColumn; hookColumn(); - hyperLinkStyler = new Styler() { - @Override - public void applyStyles(TextStyle textStyle) { - textStyle.foreground = ConnectionUIUtils.COLOR_HYPERLINK; - textStyle.underline = true; - } - }; } private void hookColumn() { @@ -122,7 +85,7 @@ return null; TreeItem item = (TreeItem) cell.getItem(); String text = getText(cell.getElement()); - List elements = parseText(text); + List elements = LinkParser.parseText(text); if (elements.isEmpty()) return null; int locMouseX = event.x - item.getTextBounds(ConnectionsView.DESCRIPTION_COLUMN_INDEX).x; @@ -211,9 +174,9 @@ public void update(ViewerCell cell) { Object element = cell.getElement(); String text = getText(element); - List elements = parseText(text); + List elements = LinkParser.parseText(text); - StyledString styledString = getStyledString(elements); + StyledString styledString = LinkParser.getStyledString(elements); cell.setText(styledString.toString()); cell.setStyleRanges(styledString.getStyleRanges()); @@ -223,34 +186,6 @@ super.update(cell); } - private List parseText(String text) { - List elements = new ArrayList(); - if (text != null) { - Matcher m = HREF_PATTERN.matcher(text); - int start = 0; - int end; - while (m.find()) { - end = m.start(); - if (start <= end) - elements.add(new Element(text.substring(start, end))); - elements.add(new LinkElement(m.group(1), m.group(2))); - start = m.end(); - } - end = text.length(); - if (start <= end) - elements.add(new Element(text.substring(start, end))); - } - return elements; - } - - private StyledString getStyledString(List elements) { - StyledString styledString = new StyledString(); - for (Element element : elements) { - styledString.append(element.getText(), element instanceof LinkElement ? hyperLinkStyler : null); - } - return styledString; - } - private String getText(Object obj) { TreeNode node = (TreeNode) obj; Object value = node.getValue(); diff -r 53f8b3193295 -r 65dabfc85192 core/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/LinkParser.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.cpp.utils.ui/src/com/nokia/cpp/internal/api/utils/ui/LinkParser.java Fri Sep 17 11:11:40 2010 -0500 @@ -0,0 +1,78 @@ +package com.nokia.cpp.internal.api.utils.ui; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.eclipse.jface.resource.JFaceColors; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.StyledString.Styler; +import org.eclipse.swt.graphics.TextStyle; +import org.eclipse.swt.widgets.Display; + +public class LinkParser { + + public static class Element { + private String text; + + public Element(String text) { + this.text = text; + } + + public String getText() { + return text; + } + } + + public static class LinkElement extends Element { + private String href; + + public LinkElement(String href, String text) { + super(text); + this.href = href; + } + + public String getHref() { + return href; + } + } + + private static final Pattern HREF_PATTERN = Pattern.compile("(.*?)", Pattern.CASE_INSENSITIVE); + private static Styler hyperLinkStyler = new Styler() { + @Override + public void applyStyles(TextStyle textStyle) { + textStyle.foreground = JFaceColors.getHyperlinkText(Display.getDefault()); + textStyle.underline = true; + } + }; + + public static List parseText(String text) { + List elements = new ArrayList(); + if (text != null) { + Matcher m = HREF_PATTERN.matcher(text); + int start = 0; + int end; + while (m.find()) { + end = m.start(); + if (start <= end) + elements.add(new Element(text.substring(start, end))); + elements.add(new LinkElement(m.group(1), m.group(2))); + start = m.end(); + } + end = text.length(); + if (start <= end) + elements.add(new Element(text.substring(start, end))); + } + return elements; + } + + public static StyledString getStyledString(List elements) { + StyledString styledString = new StyledString(); + for (Element element : elements) { + styledString.append(element.getText(), element instanceof LinkElement ? hyperLinkStyler : null); + } + return styledString; + } + +} \ No newline at end of file diff -r 53f8b3193295 -r 65dabfc85192 debuggercdi/com.nokia.cdt.debug.common/src/com/nokia/cdt/debug/common/internal/executables/SymbianSourceFileRemapping.java --- a/debuggercdi/com.nokia.cdt.debug.common/src/com/nokia/cdt/debug/common/internal/executables/SymbianSourceFileRemapping.java Fri Sep 17 11:10:59 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.common/src/com/nokia/cdt/debug/common/internal/executables/SymbianSourceFileRemapping.java Fri Sep 17 11:11:40 2010 -0500 @@ -16,19 +16,83 @@ */ package com.nokia.cdt.debug.common.internal.executables; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; + import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.executables.ISourceFileRemapping; +import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer; +import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector; +import org.eclipse.cdt.debug.internal.core.sourcelookup.MapEntrySourceContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector; +import org.eclipse.debug.core.sourcelookup.ISourceContainer; import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage; import com.nokia.cdt.debug.common.internal.source.lookup.SymbianSourceContainer; public class SymbianSourceFileRemapping implements ISourceFileRemapping { + public final String foundMappingsContainerName = "Found Mappings"; //$NON-NLS-1$ + + private Job saveThePrefsJob = new Job(""){ + + @Override + protected IStatus run(IProgressMonitor monitor) { + System.out.println("save prefs"); + CDebugCorePlugin.getDefault().savePluginPreferences(); + return Status.OK_STATUS; + }}; + + @SuppressWarnings("restriction") + private void addSourceMappingToDirector(IPath missingPath, IPath newSourcePath, AbstractSourceLookupDirector director) throws CoreException { + + ArrayList containerList = new ArrayList(Arrays.asList(director.getSourceContainers())); + + boolean hasFoundMappings = false; + + MappingSourceContainer foundMappings = null; + + for (Iterator iter = containerList.iterator(); iter.hasNext() && !hasFoundMappings;) { + ISourceContainer container = (ISourceContainer) iter.next(); + if (container instanceof MappingSourceContainer) + { + hasFoundMappings = container.getName().equals(foundMappingsContainerName); + if (hasFoundMappings) + foundMappings = (MappingSourceContainer) container; + } + } + + if (!hasFoundMappings) { + foundMappings = new MappingSourceContainer(foundMappingsContainerName); + foundMappings.init(director); + containerList.add(foundMappings); + director.setSourceContainers((ISourceContainer[]) containerList.toArray(new ISourceContainer[containerList.size()])); + } + + foundMappings.addMapEntry(new MapEntrySourceContainer(missingPath, newSourcePath)); + } + + @SuppressWarnings("restriction") + private void addSourceMappingToCommon(IPath missingPath, IPath newSourcePath) throws CoreException { + CSourceLookupDirector director = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector(); + addSourceMappingToDirector(missingPath, newSourcePath, director); + // We need to save the prefs to make sure this is persistent. But if we do it immediately + // here it will be slow and redundant if we are being used to remap a large collection + // of source files. So we save the prefs later in a job. + saveThePrefsJob.cancel(); + saveThePrefsJob.schedule(1000); + } + public String remapSourceFile(IPath executable, String filePath) { try { @@ -54,17 +118,22 @@ Object[] foundElements = symbianSourceContainer.findSourceElements(filePath); if (foundElements.length == 1) { + IPath missingPath = new Path(filePath); + IPath foundPath = null; if (foundElements[0] instanceof LocalFileStorage) { LocalFileStorage newLocation = (LocalFileStorage) foundElements[0]; - filePath = newLocation.getFullPath().toOSString(); + foundPath = newLocation.getFullPath(); + filePath = foundPath.toOSString(); } else if (foundElements[0] instanceof IResource) { IResource newResource = (IResource) foundElements[0]; - filePath = newResource.getLocation().toOSString(); + foundPath = newResource.getLocation(); + filePath = foundPath.toOSString(); } + addSourceMappingToCommon(missingPath, foundPath); } } catch (CoreException e) {} diff -r 53f8b3193295 -r 65dabfc85192 debuggercdi/com.nokia.cdt.debug.common/src/com/nokia/cdt/debug/common/internal/source/lookup/SourceMappingUtils.java --- a/debuggercdi/com.nokia.cdt.debug.common/src/com/nokia/cdt/debug/common/internal/source/lookup/SourceMappingUtils.java Fri Sep 17 11:10:59 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.common/src/com/nokia/cdt/debug/common/internal/source/lookup/SourceMappingUtils.java Fri Sep 17 11:11:40 2010 -0500 @@ -4,7 +4,9 @@ import java.util.Arrays; import java.util.Iterator; +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; @@ -70,6 +72,16 @@ if (!hasSymbianContainer) { String epocRootPath = configuration.getAttribute( EPOCROOT_SETTING, (String)null ); + if (epocRootPath == null) + { + String exeName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, ""); + IPath executable = new Path(exeName); + String[] segs = executable.segments(); + for (int i = 0; i < segs.length; i++) { + if (segs[i].equalsIgnoreCase("epoc32")) + epocRootPath = executable.removeLastSegments(segs.length - i).toOSString(); + } + } if (epocRootPath != null) { symbianContainer = new SymbianSourceContainer(new Path(epocRootPath)); diff -r 53f8b3193295 -r 65dabfc85192 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java Fri Sep 17 11:10:59 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java Fri Sep 17 11:11:40 2010 -0500 @@ -38,6 +38,7 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StyledString; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ControlAdapter; import org.eclipse.swt.events.ControlEvent; @@ -59,13 +60,15 @@ import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; import com.nokia.carbide.remoteconnections.interfaces.IConnectedService; +import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatusChangedListener; import com.nokia.carbide.remoteconnections.interfaces.IConnection; import com.nokia.carbide.remoteconnections.interfaces.IConnectionType; import com.nokia.carbide.remoteconnections.interfaces.IConnectionTypeProvider; import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager; -import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatusChangedListener; import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionListener; import com.nokia.carbide.remoteconnections.settings.ui.SettingsWizard; +import com.nokia.cpp.internal.api.utils.ui.LinkParser; +import com.nokia.cpp.internal.api.utils.ui.LinkParser.Element; /** * This dialog allows in-depth configuration of the connection settings. @@ -216,6 +219,11 @@ if (!serviceStatus.getEStatus().equals( com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus.EStatus.UP)) { String description = serviceStatus.getLongDescription(); + if (description != null) { + List elements = LinkParser.parseText(description); + StyledString styledString = LinkParser.getStyledString(elements); + description = styledString.getString(); + } status = warning(Messages.getString("ConnectToDeviceDialog.ServiceNotAvailWarning"), //$NON-NLS-1$ description == null ? "" : description); //$NON-NLS-1$ }