Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2014-09-02 08:38:49 -0400
committerTobias Schwarz2014-09-02 08:38:49 -0400
commit0474cddd230adc7947b6f81fa0b496cbced68526 (patch)
treef5ab0684b791826d7dab87a7dc784beeb4ea0048
parenta99ce260718f005b741863ddaded4626ca472be8 (diff)
downloadorg.eclipse.tcf-0474cddd230adc7947b6f81fa0b496cbced68526.tar.gz
org.eclipse.tcf-0474cddd230adc7947b6f81fa0b496cbced68526.tar.xz
org.eclipse.tcf-0474cddd230adc7947b6f81fa0b496cbced68526.zip
Target Explorer: fix export issue
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/ExportPersistenceService.java22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/PeerPersistableURIProvider.java26
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/PeerModelRefreshService.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/PeerExportWizardPage.java9
4 files changed, 43 insertions, 19 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/ExportPersistenceService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/ExportPersistenceService.java
index d27a2a848..d49750658 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/ExportPersistenceService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/ExportPersistenceService.java
@@ -18,10 +18,13 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.tcf.core.TransientPeer;
+import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.te.runtime.persistence.PersistenceManager;
+import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistableNodeProperties;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate;
import org.eclipse.tcf.te.runtime.persistence.services.URIPersistenceService;
import org.eclipse.tcf.te.tcf.core.interfaces.IExportPersistenceService;
+import org.eclipse.tcf.te.tcf.core.interfaces.IPeerProperties;
import org.eclipse.tcf.te.tcf.launch.core.interfaces.ILaunchTypes;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
@@ -55,13 +58,26 @@ public class ExportPersistenceService extends URIPersistenceService implements I
final String launchConfigString = (String)launchDelegate.write(launchConfig, String.class);
Map<String,String> attrs = new HashMap<String, String>(node.getPeer().getAttributes());
attrs.put(ILaunchTypes.ATTACH, launchConfigString);
+ attrs.remove(IPersistableNodeProperties.PROPERTY_URI);
+ attrs.remove(IPeerProperties.PROP_MIGRATED);
delegate.write(new TransientPeer(attrs), uri);
return;
}
}
+ // Pass on to the delegate for writing
+ Map<String,String> attrs = new HashMap<String, String>(node.getPeer().getAttributes());
+ attrs.remove(IPersistableNodeProperties.PROPERTY_URI);
+ attrs.remove(IPeerProperties.PROP_MIGRATED);
+ delegate.write(new TransientPeer(attrs), uri);
+ }
+ else if (context instanceof IPeer) {
+ Map<String,String> attrs = new HashMap<String, String>(((IPeer)context).getAttributes());
+ attrs.remove(IPersistableNodeProperties.PROPERTY_URI);
+ attrs.remove(IPeerProperties.PROP_MIGRATED);
+ delegate.write(new TransientPeer(attrs), uri);
+ }
+ else {
+ delegate.write(context, uri);
}
-
- // Pass on to the delegate for writing
- delegate.write(context, uri);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/PeerPersistableURIProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/PeerPersistableURIProvider.java
index c3b951af8..ba692f0ed 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/PeerPersistableURIProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/PeerPersistableURIProvider.java
@@ -74,7 +74,7 @@ public class PeerPersistableURIProvider extends ModelNodePersistableURIProvider
nodeURI.set(URI.create(value.trim()));
}
value = peer.getAttributes().get(IPeerProperties.PROP_VERSION);
- version.set(value != null ? new Version(value.trim()) : Version.emptyVersion);
+ version.set(value != null ? new Version(value.trim()) : null);
}
};
if (Protocol.isDispatchThread()) {
@@ -89,24 +89,22 @@ public class PeerPersistableURIProvider extends ModelNodePersistableURIProvider
}
if (uri == null) {
- String name = peer.getName();
- if (name == null) {
- name = peer.getID();
+ String baseName = peer.getName();
+ if (baseName == null) {
+ baseName = peer.getID();
}
- name = makeValidFileSystemName(name);
+ String name = makeValidFileSystemName(baseName);
// Get the URI from the name
- uri = getRoot().append(name+".peer").toFile().toURI(); //$NON-NLS-1$
+ uri = getRoot().append(name + ".peer").toFile().toURI(); //$NON-NLS-1$
try {
File file = new File(uri.normalize());
- if (file.exists()) {
- name = makeValidFileSystemName(name + "_" + version.toString()); //$NON-NLS-1$
- uri = getRoot().append(name+".peer").toFile().toURI(); //$NON-NLS-1$
- }
- file = new File(uri.normalize());
- int i = 1;
+ int i = 0;
while (file.exists()) {
- name = makeValidFileSystemName(name + "_" + i); //$NON-NLS-1$
- uri = getRoot().append(name+".peer").toFile().toURI(); //$NON-NLS-1$
+ name = makeValidFileSystemName(baseName +
+ (version.get() != null ? "_" + version.get().toString() : "") + //$NON-NLS-1$ //$NON-NLS-2$
+ (i > 0 ? " (" + i + ")": "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ uri = getRoot().append(name + ".peer").toFile().toURI(); //$NON-NLS-1$
+ file = new File(uri.normalize());
i++;
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/PeerModelRefreshService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/PeerModelRefreshService.java
index 732b92b60..f2b002573 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/PeerModelRefreshService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/PeerModelRefreshService.java
@@ -11,6 +11,7 @@ package org.eclipse.tcf.te.tcf.locator.services;
import java.io.File;
import java.io.FileFilter;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -241,7 +242,9 @@ public class PeerModelRefreshService extends AbstractPeerModelService implements
attrs.put(IPersistableNodeProperties.PROPERTY_URI, null);
attrs.put(IPeerProperties.PROP_VERSION, activeVersion.toString());
peer = new Peer(attrs);
- service.write(peer, null);
+ URI uri = service.getURI(peer);
+ attrs.put(IPersistableNodeProperties.PROPERTY_URI, uri.toString());
+ service.write(peer, uri);
// Add the migrated peer to the peers map
peers.put(peer.getID(), peer);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/PeerExportWizardPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/PeerExportWizardPage.java
index b31b948b3..7c4eb3b9b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/PeerExportWizardPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/pages/PeerExportWizardPage.java
@@ -142,7 +142,14 @@ public class PeerExportWizardPage extends WizardPage {
@Override
public Object[] getElements(Object inputElement) {
if (inputElement instanceof IPeerModel) {
- return ((IPeerModel)inputElement).getPeerNodes();
+ IPeerNode[] nodes = ((IPeerModel)inputElement).getPeerNodes();
+ List<IPeerNode> filteredNodes = new ArrayList<IPeerNode>();
+ for (IPeerNode node : nodes) {
+ if (node.isVisible()) {
+ filteredNodes.add(node);
+ }
+ }
+ return filteredNodes.toArray();
}
return new Object[0];
}

Back to the top