| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2015 Ericsson |
| 3 | * |
| 4 | * All rights reserved. This program and the accompanying materials are |
| 5 | * made available under the terms of the Eclipse Public License v1.0 which |
| 6 | * accompanies this distribution, and is available at |
| 7 | * http://www.eclipse.org/legal/epl-v10.html |
| 8 | * |
| 9 | * Contributors: |
| 10 | * Marc-Andre Laperle - Initial API and implementation |
| 11 | *******************************************************************************/ |
| 12 | |
| 13 | package org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model; |
| 14 | |
| 15 | import org.eclipse.swt.graphics.Image; |
| 16 | import org.eclipse.tracecompass.internal.tmf.remote.ui.Activator; |
| 17 | import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageElement; |
| 18 | |
| 19 | /** |
| 20 | * An RemoteImportConnectionNodeElement representing a connection node. |
| 21 | * |
| 22 | * @author Marc-Andre Laperle |
| 23 | */ |
| 24 | public class RemoteImportConnectionNodeElement extends TracePackageElement { |
| 25 | |
| 26 | private static final String IMAGE_PATH = "icons/obj/connection_node.gif"; //$NON-NLS-1$ |
| 27 | |
| 28 | private String fName; |
| 29 | private String fURI; |
| 30 | |
| 31 | /** |
| 32 | * Constructs an instance of RemoteImportConnectionNodeElement. |
| 33 | * |
| 34 | * @param parent |
| 35 | * the parent of this element, can be set to null |
| 36 | * @param name |
| 37 | * the node name |
| 38 | * @param uri |
| 39 | * the URI in string form to connect to the node |
| 40 | */ |
| 41 | public RemoteImportConnectionNodeElement(TracePackageElement parent, |
| 42 | String name, String uri) { |
| 43 | super(parent); |
| 44 | fName = name; |
| 45 | fURI = uri; |
| 46 | } |
| 47 | |
| 48 | @Override |
| 49 | public String getText() { |
| 50 | return fName + " (" + fURI + ")"; //$NON-NLS-1$//$NON-NLS-2$ |
| 51 | } |
| 52 | |
| 53 | @Override |
| 54 | public Image getImage() { |
| 55 | return Activator.getDefault().getImageFromImageRegistry(IMAGE_PATH); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Get the name of the connection. |
| 60 | * |
| 61 | * @return the name of the connection |
| 62 | */ |
| 63 | public String getName() { |
| 64 | return fName; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Set the name of the connection. |
| 69 | * |
| 70 | * @param name the name of the connection |
| 71 | */ |
| 72 | public void setName(String name) { |
| 73 | fName = name; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Get the URI of the connection. |
| 78 | * |
| 79 | * @return the URI of the connection |
| 80 | */ |
| 81 | public String getURI() { |
| 82 | return fURI; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Set the URI of the connection. |
| 87 | * |
| 88 | * @param uri the URI of the connection |
| 89 | */ |
| 90 | public void setURI(String uri) { |
| 91 | fURI = uri; |
| 92 | } |
| 93 | |
| 94 | } |