tmf: Update copyright headers in tmf.ui
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / handlers / ShowNodeStart.java
index dba63a3e4a31324d0b8cf64bea159b9ca7e8f802..68fd0f3b6567720317fed9edd5494aacf26dea34 100755 (executable)
@@ -1,15 +1,15 @@
 /**********************************************************************
- * Copyright (c) 2005, 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 IBM Corporation, Ericsson
  * 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
- * $Id: ShowNodeStart.java,v 1.3 2006/09/20 20:56:26 ewchan Exp $
- * 
- * Contributors: 
- * IBM - Initial API and implementation
- * Bernd Hufmann - Updated for TMF
+ *
+ * Contributors:
+ *     IBM - Initial API and implementation
+ *     Bernd Hufmann - Updated for TMF
  **********************************************************************/
+
 package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
 
 import java.util.Iterator;
@@ -19,13 +19,16 @@ import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionProvider;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
-import org.eclipse.linuxtools.internal.tmf.ui.TmfUiPlugin;
+import org.eclipse.linuxtools.internal.tmf.ui.Activator;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDWidget;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode;
 import org.eclipse.ui.IViewPart;
 
 /**
+ * Action class implementation to show end of a graph node.
+ *
+ * @version 1.0
  * @author sveyrier
  */
 public class ShowNodeStart extends Action {
@@ -33,25 +36,36 @@ public class ShowNodeStart extends Action {
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
+    /**
+     * The sequence diagram view reference
+     */
     protected SDView fView = null;
 
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
+    /**
+     * Default constructor
+     */
     public ShowNodeStart() {
         this(null);
     }
-    
-    public ShowNodeStart(IViewPart _view) {
+
+    /**
+     * Constructor
+     *
+     * @param view The sequence diagram view reference
+     */
+    public ShowNodeStart(IViewPart view) {
         super();
-        if (_view instanceof SDView) {
-            fView = (SDView)_view;
+        if (view instanceof SDView) {
+            fView = (SDView)view;
         }
-        setImageDescriptor(TmfUiPlugin.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_NODE_START));
+        setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_NODE_START));
     }
 
     // ------------------------------------------------------------------------
-    // Operations
+    // Methods
     // ------------------------------------------------------------------------
     /*
      * (non-Javadoc)
@@ -60,30 +74,39 @@ public class ShowNodeStart extends Action {
    @Override
     @SuppressWarnings("rawtypes")
     public void run() {
-        if (fView == null)
+        if (fView == null) {
             return;
+        }
+
         SDWidget sdWidget = fView.getSDWidget();
 
         if (sdWidget == null) {
             return;
         }
-        
+
         ISelectionProvider selProvider = sdWidget.getSelectionProvider();
         ISelection sel = selProvider.getSelection();
         Object selectedNode = null;
         Iterator it = ((StructuredSelection) sel).iterator();
-        while (it.hasNext())
+        while (it.hasNext()) {
             selectedNode = it.next();
+        }
         if (selectedNode != null) {
             GraphNode node = (GraphNode) selectedNode;
-            if (node.getX() * sdWidget.getZoomFactor() < sdWidget.getContentsX() + sdWidget.getVisibleWidth() / 2)
+            if (node.getX() * sdWidget.getZoomFactor() < sdWidget.getContentsX() + sdWidget.getVisibleWidth() / 2) {
                 sdWidget.ensureVisible(Math.round(node.getX() * sdWidget.getZoomFactor() - sdWidget.getVisibleWidth() / (float) 2), Math.round(node.getY() * sdWidget.getZoomFactor()));
-            else
+            } else {
                 sdWidget.ensureVisible(Math.round(node.getX() * sdWidget.getZoomFactor() + sdWidget.getVisibleWidth() / (float) 2), Math.round(node.getY() * sdWidget.getZoomFactor()));
+            }
         }
     }
 
-   public void setView(SDView view) {
+   /**
+    * Sets the active SD view.
+    *
+    * @param view The SD view.
+    */
+  public void setView(SDView view) {
        fView = view;
    }
 }
This page took 0.025911 seconds and 5 git commands to generate.