ss: Move plugins to Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / project / wizards / tracepkg / TracePackageElement.java
index da0386a93335974323eaca9e9b31c7da2a90568b..4792f2e9627a98f096909cd81c252e842d0cd571 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013 Ericsson
+ * Copyright (c) 2013, 2014 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -12,6 +12,9 @@
 
 package org.eclipse.linuxtools.internal.tmf.ui.project.wizards.tracepkg;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.ui.model.WorkbenchAdapter;
 
@@ -25,6 +28,7 @@ public abstract class TracePackageElement extends WorkbenchAdapter {
     private final TracePackageElement fParent;
     private boolean fEnabled;
     private boolean fChecked;
+    private boolean fVisible;
 
     /**
      *
@@ -34,6 +38,8 @@ public abstract class TracePackageElement extends WorkbenchAdapter {
     public TracePackageElement(TracePackageElement parent) {
         fParent = parent;
         fEnabled = true;
+        fVisible = true;
+        fChildren = new TracePackageElement[0];
     }
 
     /**
@@ -59,6 +65,21 @@ public abstract class TracePackageElement extends WorkbenchAdapter {
         return fChildren;
     }
 
+    /**
+     * Get the visible children of this element
+     *
+     * @return the visible children of this element
+     */
+    public TracePackageElement[] getVisibleChildren() {
+        List<TracePackageElement> visibleChildren = new ArrayList<>();
+        for (TracePackageElement child : fChildren) {
+            if (child.isVisible()) {
+                visibleChildren.add(child);
+            }
+        }
+        return visibleChildren.toArray(new TracePackageElement[0]);
+    }
+
     /**
      * Set the children of this element
      *
@@ -116,6 +137,15 @@ public abstract class TracePackageElement extends WorkbenchAdapter {
         return fChecked;
     }
 
+    /**
+     * Returns whether or not the element is visible.
+     *
+     * @return whether or not the element is visible
+     */
+    public boolean isVisible() {
+        return fVisible;
+    }
+
     /**
      * Sets whether or not the element should be enabled (grayed and not
      * modifiable).
@@ -136,4 +166,14 @@ public abstract class TracePackageElement extends WorkbenchAdapter {
     public void setChecked(boolean checked) {
         fChecked = checked;
     }
+
+    /**
+     * Sets whether or not the element is visible.
+     *
+     * @param visible
+     *            if the element should be visible
+     */
+    public void setVisible(boolean visible) {
+        fVisible = visible;
+    }
 }
\ No newline at end of file
This page took 0.038647 seconds and 5 git commands to generate.