diff options
author | Uwe Stieber | 2013-06-04 09:16:50 +0000 |
---|---|---|
committer | Uwe Stieber | 2013-06-04 09:16:50 +0000 |
commit | bfeb41386bfb257436ec0ebe7315a168eaf53e58 (patch) | |
tree | 9e18f7fb80eda1562a081ba7fa043d33435cc2bd /target_explorer | |
parent | 21e6b0216da134bd16a9e927924b17b1fecf3346 (diff) | |
download | org.eclipse.tcf-bfeb41386bfb257436ec0ebe7315a168eaf53e58.tar.gz org.eclipse.tcf-bfeb41386bfb257436ec0ebe7315a168eaf53e58.tar.xz org.eclipse.tcf-bfeb41386bfb257436ec0ebe7315a168eaf53e58.zip |
Target Explorer: Remove unused class
Diffstat (limited to 'target_explorer')
-rw-r--r-- | target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/MapPersistableURIProvider.java | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/MapPersistableURIProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/MapPersistableURIProvider.java deleted file mode 100644 index 6ab1cd797..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/adapters/MapPersistableURIProvider.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 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.locator.internal.adapters; - -import java.net.URI; -import java.util.Map; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.tcf.protocol.IPeer; -import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistableURIProvider; -import org.eclipse.tcf.te.tcf.locator.activator.CoreBundleActivator; - -/** - * Persistable implementation handling peer attributes. - */ -public class MapPersistableURIProvider implements IPersistableURIProvider { - - /* (non-Javadoc) - * @see org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistableURIProvider#getURI(java.lang.Object) - */ - @SuppressWarnings("unchecked") - @Override - public URI getURI(final Object context) { - Assert.isNotNull(context); - - URI uri = null; - - // Only map objects are supported - if (context instanceof Map) { - // Get the name of the peer and make it a valid - // file system name (no spaces etc). - String name = ((Map<String, String>) context).get(IPeer.ATTR_NAME); - if (name == null) { - name = ((Map<String, String>) context).get(IPeer.ATTR_ID); - } - name = makeValidFileSystemName(name); - // Get the URI from the name - uri = getRoot().append(name).toFile().toURI(); - } - - return uri; - } - - /** - * Make a valid file system name from the given name. - * - * @param name The original name. Must not be <code>null</code>. - * @return The valid file system name. - */ - private String makeValidFileSystemName(String name) { - Assert.isNotNull(name); - return name.replaceAll("\\W", "_"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Returns the root location. - * - * @return The root location or <code>null</code> if it cannot be determined. - */ - protected IPath getRoot() { - IPath location = null; - - // Try the bundles state location first (not available if launched with -data @none). - try { - IPath path = CoreBundleActivator.getDefault().getStateLocation().append(".peers"); //$NON-NLS-1$ - boolean exists = path.toFile().exists(); - if (!exists) exists = path.toFile().mkdirs(); - if (exists && path.toFile().canRead() && path.toFile().isDirectory()) { - location = path; - } - } catch (IllegalStateException e) { - // Workspace less environments (-data @none) - // The users local peers lookup directory is $HOME/.tcf/.peers. - IPath path = new Path(System.getProperty("user.home")).append(".tcf/.peers"); //$NON-NLS-1$ //$NON-NLS-2$ - boolean exists = path.toFile().exists(); - if (!exists) exists = path.toFile().mkdirs(); - if (exists && path.toFile().canRead() && path.toFile().isDirectory()) { - location = path; - } - } - - return location; - } -} |