diff options
Diffstat (limited to 'target_explorer')
3 files changed, 57 insertions, 10 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPathMapGeneratorService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPathMapGeneratorService.java new file mode 100644 index 000000000..3332bf478 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPathMapGeneratorService.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2013 Wind River Systems, Inc. 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.tcf.core.interfaces; + +import org.eclipse.tcf.services.IPathMap; +import org.eclipse.tcf.te.runtime.services.interfaces.IService; + +/** + * Provides a set of generated path map rules. + * <p> + * Auto generated path map rules typically differs between target types and + * are typically not to be editable for the user. The path map rules provided + * by this service are not necessarily persisted. + */ +public interface IPathMapGeneratorService extends IService { + + /** + * Return the generated (object) path mappings for the given context. + * + * @param context The context. Must not be <code>null</code>. + * @return The generated path map or <code>null</code>. + */ + public IPathMap.PathMapRule[] getPathMap(Object context); +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPathMapService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPathMapService.java index 947244953..7e9f6f1fc 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPathMapService.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPathMapService.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013 Wind River Systems, Inc. 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 diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java index 1d19733a2..df407872e 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013 Wind River Systems, Inc. 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 @@ -10,6 +10,8 @@ package org.eclipse.tcf.te.tcf.launch.core.internal.services; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.CoreException; @@ -19,6 +21,8 @@ import org.eclipse.tcf.protocol.Protocol; import org.eclipse.tcf.services.IPathMap; import org.eclipse.tcf.services.IPathMap.PathMapRule; import org.eclipse.tcf.te.runtime.services.AbstractService; +import org.eclipse.tcf.te.runtime.services.ServiceManager; +import org.eclipse.tcf.te.tcf.core.interfaces.IPathMapGeneratorService; import org.eclipse.tcf.te.tcf.core.interfaces.IPathMapService; /** @@ -35,6 +39,7 @@ public class PathMapService extends AbstractService implements IPathMapService { Assert.isNotNull(context); PathMapRule[] rules = null; + List<PathMapRule> rulesList = new ArrayList<PathMapRule>(); // Get the launch configuration for that peer model ILaunchConfiguration config = (ILaunchConfiguration) Platform.getAdapterManager().getAdapter(context, ILaunchConfiguration.class); @@ -44,19 +49,30 @@ public class PathMapService extends AbstractService implements IPathMapService { if (config != null) { try { + String path_map_cfg = config.getAttribute(org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate.ATTR_PATH_MAP, ""); //$NON-NLS-1$ - ArrayList<org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate.PathMapRule> map = org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate.parsePathMapAttribute(path_map_cfg); + rulesList.addAll(org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate.parsePathMapAttribute(path_map_cfg)); + path_map_cfg = config.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, ""); //$NON-NLS-1$ - map.addAll(org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate.parseSourceLocatorMemento(path_map_cfg)); - if (!map.isEmpty()) { - int cnt = 0; - String id = getClientID(); - for (PathMapRule r : map) r.getProperties().put(IPathMap.PROP_ID, id + "/" + cnt++); //$NON-NLS-1$ - rules = map.toArray(new PathMapRule[map.size()]); - } + rulesList.addAll(org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate.parseSourceLocatorMemento(path_map_cfg)); } catch (CoreException e) { /* ignored on purpose */ } } + IPathMapGeneratorService generator = ServiceManager.getInstance().getService(context, IPathMapGeneratorService.class); + if (generator != null) { + PathMapRule[] generatedRules = generator.getPathMap(context); + if (generatedRules != null && generatedRules.length > 0) { + rulesList.addAll(Arrays.asList(generatedRules)); + } + } + + if (!rulesList.isEmpty()) { + int cnt = 0; + String id = getClientID(); + for (PathMapRule r : rulesList) r.getProperties().put(IPathMap.PROP_ID, id + "/" + cnt++); //$NON-NLS-1$ + rules = rulesList.toArray(new PathMapRule[rulesList.size()]); + } + return rules; } |