Finds the "nearest" info panel.

@param container The container from which to begin the search.
@param activeOnly If true, only active info panels are considered.
@return The nearest active info panel, or null if none found.
547255
public static IInfoPanel findInfoPanel(PluginContainer container, boolean activeOnly) {
        return findInfoPanel(ElementUI.getAssociatedElement(container), activeOnly);
    }
868073
public static void getDsTableColumnProperties(final Container container) {
        final LazyQueryContainer lqc = (LazyQueryContainer) container;
        lqc.addContainerProperty(SPUILabelDefinitions.VAR_ID, Long.class, null, false, false);
        lqc.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false, true);
        lqc.addContainerProperty(SPUILabelDefinitions.VAR_VERSION, String.class, null, false, false);
        lqc.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, null, false, true);
        lqc.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_BY, String.class, null, false, true);
        lqc.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, String.class, null, false, true);
        lqc.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, String.class, null, false, true);
        lqc.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, String.class, null, false, true);
    }
1175437
public List<ContainerData> selectJars(ContainerData targetContainerData) throws ClassSource_Exception {
        List<ContainerData> jarContainers = new ArrayList<ContainerData>();

        // A null target container means than an explicitly
        // specified container was not located.  That is an error.

        Container targetContainer = targetContainerData.container;
        if (targetContainer == null) {
            throw new ClassSource_Exception("Container [ " + targetContainerData.name + " ] was not resolved");
        }

        for (Entry nextEntry : targetContainerData.container) {
            String nextEntryName = nextEntry.getName();
            if (!nextEntryName.toUpperCase().endsWith(".JAR")) {
                continue; // The targets MUST have the ".jar" extension.
            }

            try {
                Container nextContainer = nextEntry.adapt(Container.class);
                if (nextContainer == null) {
                    continue; // TODO: This should be an error
                }

                ContainerData nextContainerData =
                                new ContainerData(targetContainerData.name + " to " + nextEntryName, nextContainer);

                jarContainers.add(nextContainerData);
            } catch (UnableToAdaptException e) {
                throw new ClassSource_Exception("JAR select [ " + nextEntryName + " ] could not be used as a container: " + e);
            }
        }

        return jarContainers;
    }
786516
public ElementUI getNextSibling(boolean visibleOnly) {
        ElementUI parent = getParent();
        
        if (parent != null) {
            int count = parent.getChildCount();
            
            for (int i = getIndex() + 1; i < count; i++) {
                ElementUI child = (ElementUI) parent.getChild(i);
                
                if (!visibleOnly || child.isVisible()) {
                    return child;
                }
            }
        }
        
        return null;
    }
73901
private ExoContainer getContainer() throws ResourceException
   {
      ExoContainer container = ExoContainerContext.getCurrentContainer();
      if (container instanceof RootContainer)
      {
         String portalContainerName =
            portalContainer == null ? PortalContainer.DEFAULT_PORTAL_CONTAINER_NAME : portalContainer;
         container = RootContainer.getInstance().getPortalContainer(portalContainerName);
         if (container == null)
         {
            throw new ResourceException("The eXo container is null, because the current container is a RootContainer "
               + "and there is no PortalContainer with the name '" + portalContainerName + "'.");
         }
      }
      else if (container == null)
      {
         throw new ResourceException("The eXo container is null, because the current container is null.");
      }
      return container;
   }
482753
private int addRuleContainer(SpatialRuleContainer container) {
        int newIndex = this.ruleContainers.indexOf(container);
        if (newIndex >= 0)
            return newIndex;

        newIndex = ruleContainers.size();
        if (newIndex >= 255)
            throw new IllegalStateException("No more spatial rule container fit into this lookup as 255 combination of ruleContainers reached");

        this.ruleContainers.add(container);
        return newIndex;
    }
193115
def find_target_container(portal_type, record):
    
    portal_type = portal_type or record.get("portal_type")
    container = get_container_for(portal_type)
    if container:
        return container

    parent_uid = record.pop("parent_uid", None)
    parent_path = record.pop("parent_path", None)

    target = None

    # Try to find the target object
    if parent_uid:
        target = get_object_by_uid(parent_uid)
    elif parent_path:
        target = get_object_by_path(parent_path)
    else:
        fail(404, "No target UID/PATH information found")

    if not target:
        fail(404, "No target container found")

    return target
1128686
@Override
    public String getContainerClientId(FacesContext ctx)
    {
        if (isPrependId())
        {
            return super.getContainerClientId(ctx);
        }
        UIComponent parentNamingContainer = _ComponentUtils.findParentNamingContainer(this, false);
        if (parentNamingContainer != null)
        {
            return parentNamingContainer.getContainerClientId(ctx);
        }
        return null;
    }
502047
@SuppressWarnings("unchecked")
    public <T extends XPathBuilder> T setContainer(WebLocator container) {
        this.container = container;
        return (T) this;
    }
647931
public Optional<ServerPort> activePort() {
        synchronized (activePorts) {
            return Optional.ofNullable(Iterables.getFirst(activePorts.values(), null));
        }
    }
912546
public ContainerPointer getContainerPointer(final int startIndex) {
    return new ContainerPointer() {
      int k = startIndex;

      @Override
      public void advance() {
        ++k;

      }

      @Override
      public ContainerPointer clone() {
        try {
          return (ContainerPointer) super.clone();
        } catch (CloneNotSupportedException e) {
          return null;// will not happen
        }
      }

      @Override
      public int compareTo(ContainerPointer o) {
        if (key() != o.key()) {
          return Util.toIntUnsigned(key()) - Util.toIntUnsigned(o.key());
        }
        return o.getCardinality() - getCardinality();
      }

      @Override
      public int getCardinality() {
        return getContainer().getCardinality();
      }

      @Override
      public Container getContainer() {
        if (k >= RoaringArray.this.size) {
          return null;
        }
        return RoaringArray.this.values[k];
      }


      @Override
      public boolean isBitmapContainer() {
        return getContainer() instanceof BitmapContainer;
      }

      @Override
      public boolean isRunContainer() {
        return getContainer() instanceof RunContainer;
      }


      @Override
      public short key() {
        return RoaringArray.this.keys[k];

      }
    };
  }
1181245
IWorkbenchPart getActivePart() {
		final IWorkbenchWindow activeWindow = getWorkbench().getActiveWorkbenchWindow();
		if (activeWindow != null) {
			final IWorkbenchPage activePage = activeWindow.getActivePage();
			if (activePage != null) {
				return activePage.getActivePart();
			}
		}
		return null;
	}
1240785
def find_container(cid=None, primary_admin_gate_url=None):
        
        LOGGER.debug("ContainerService.find_container")
        ret = None
        if (cid is None or not cid) and (primary_admin_gate_url is None or not primary_admin_gate_url):
            raise exceptions.ArianeCallParametersError('id and primary_admin_gate_url')

        if (cid is not None and cid) and (primary_admin_gate_url is not None and primary_admin_gate_url):
            LOGGER.debug('ContainerService.find_container - Both id and primary admin gate url are defined. '
                         'Will give you search on id.')
            # traceback.print_stack()
            primary_admin_gate_url = None

        params = None
        if cid is not None and cid:
            params = SessionService.complete_transactional_req({'ID': cid})
            if MappingService.driver_type != DriverFactory.DRIVER_REST:
                params['OPERATION'] = 'getContainer'
        elif primary_admin_gate_url is not None and primary_admin_gate_url:
            params = SessionService.complete_transactional_req({'primaryAdminURL': primary_admin_gate_url})
            if MappingService.driver_type != DriverFactory.DRIVER_REST:
                params['OPERATION'] = 'getContainerByPrimaryAdminURL'

        if params is not None:
            if MappingService.driver_type != DriverFactory.DRIVER_REST:
                args = {"properties": params}
            else:
                args = {'http_operation': 'GET', 'operation_path': 'get', 'parameters': params}

            response = ContainerService.requester.call(args)

            if MappingService.driver_type != DriverFactory.DRIVER_REST:
                response = response.get()

            if response.rc == 0:
                ret = Container.json_2_container(response.response_content)
            elif response.rc != 404:
                err_msg = 'ContainerService.find_container - Problem while finding container (id:' + \
                          str(cid) + ', primary admin gate url '\
                          + str(primary_admin_gate_url) + ' ). ' + \
                          'Reason: ' + str(response.response_content) + ' - ' + str(response.error_message) + \
                          " (" + str(response.rc) + ")"
                LOGGER.warning(err_msg)
                if response.rc == 500 and ArianeMappingOverloadError.ERROR_MSG in response.error_message:
                    raise ArianeMappingOverloadError("ContainerService.find_container",
                                                     ArianeMappingOverloadError.ERROR_MSG)
                # traceback.print_stack()
        return ret
307150
private static String getLocalInterfaceName(EnterpriseBean enterpriseBean)
    {
        if (enterpriseBean instanceof ComponentViewableBean)
        {
            return ((ComponentViewableBean) enterpriseBean).getLocalInterfaceName();
        }

        return null;
    }
250078
public void sort(ChildTaskContainer container)
   {
      // Do we have any tasks?
      List<Task> tasks = container.getChildTasks();
      if (!tasks.isEmpty())
      {
         for (Task task : tasks)
         {
            //
            // Sort child activities
            //
            sort(task);

            //
            // Sort Order:
            // 1. Activities come first
            // 2. WBS come last
            // 3. Activities ordered by activity ID
            // 4. WBS ordered by ID
            //
            Collections.sort(tasks, new Comparator<Task>()
            {
               @Override public int compare(Task t1, Task t2)
               {
                  boolean t1IsWbs = m_wbsTasks.contains(t1);
                  boolean t2IsWbs = m_wbsTasks.contains(t2);

                  // Both are WBS
                  if (t1IsWbs && t2IsWbs)
                  {
                     return t1.getID().compareTo(t2.getID());
                  }

                  // Both are activities
                  if (!t1IsWbs && !t2IsWbs)
                  {
                     String activityID1 = (String) t1.getCurrentValue(m_activityIDField);
                     String activityID2 = (String) t2.getCurrentValue(m_activityIDField);

                     if (activityID1 == null || activityID2 == null)
                     {
                        return (activityID1 == null && activityID2 == null ? 0 : (activityID1 == null ? 1 : -1));
                     }

                     return activityID1.compareTo(activityID2);
                  }

                  // One activity one WBS
                  return t1IsWbs ? 1 : -1;
               }
            });
         }
      }
   }
804625
public void createContainer(String container) {

        ContainerController controller = this.platformContainers.get(container);
        if (controller == null) {

            // TODO make this configurable
            Profile p = new ProfileImpl();
            p.setParameter(Profile.PLATFORM_ID, PLATFORM_ID);
            p.setParameter(Profile.MAIN_HOST, MAIN_HOST);
            p.setParameter(Profile.MAIN_PORT, MAIN_PORT);
            p.setParameter(Profile.LOCAL_HOST, MAIN_HOST);
            int port = Integer.parseInt(MAIN_PORT);
            port = port + 1 + this.platformContainers.size();
            p.setParameter(Profile.LOCAL_PORT, Integer.toString(port));
            p.setParameter(Profile.CONTAINER_NAME, container);
            logger.fine("Creating container " + container + "...");
            ContainerController agentContainer = this.runtime
                    .createAgentContainer(p);
            this.platformContainers.put(container, agentContainer);
            logger.fine("Container " + container + " created successfully.");
        } else {
            logger.fine("Container " + container + " is already created.");
        }

    }
837699
public DockerContainerObjectBuilder<T> withContainerObjectClass(Class<T> containerObjectClass) {
        if (containerObjectClass == null) {
            throw new IllegalArgumentException("container object class cannot be null");
        }
        this.containerObjectClass = containerObjectClass;

        //First we check if this ContainerObject is defining a @CubeDockerFile in static method
        final List<Method> methodsWithCubeDockerFile =
            ReflectionUtil.getMethodsWithAnnotation(containerObjectClass, CubeDockerFile.class);

        if (methodsWithCubeDockerFile.size() > 1) {
            throw new IllegalArgumentException(
                String.format(
                    "More than one %s annotation found and only one was expected. Methods where annotation was found are: %s",
                    CubeDockerFile.class.getSimpleName(), methodsWithCubeDockerFile));
        }

        classHasMethodWithCubeDockerFile = !methodsWithCubeDockerFile.isEmpty();
        classDefinesCubeDockerFile = containerObjectClass.isAnnotationPresent(CubeDockerFile.class);
        classDefinesImage = containerObjectClass.isAnnotationPresent(Image.class);

        if (classHasMethodWithCubeDockerFile) {
            methodWithCubeDockerFile = methodsWithCubeDockerFile.get(0);
            boolean isMethodStatic = Modifier.isStatic(methodWithCubeDockerFile.getModifiers());
            boolean methodHasNoArguments = methodWithCubeDockerFile.getParameterCount() == 0;
            boolean methodReturnsAnArchive = Archive.class.isAssignableFrom(methodWithCubeDockerFile.getReturnType());
            if (!isMethodStatic || !methodHasNoArguments || !methodReturnsAnArchive) {
                throw new IllegalArgumentException(
                    String.format("Method %s annotated with %s is expected to be static, no args and return %s.",
                        methodWithCubeDockerFile, CubeDockerFile.class.getSimpleName(), Archive.class.getSimpleName()));
            }
        }

        // User has defined @CubeDockerfile on the class and a method
        if (classHasMethodWithCubeDockerFile && classDefinesCubeDockerFile) {
            throw new IllegalArgumentException(
                String.format(
                    "More than one %s annotation found and only one was expected. Both class and method %s has the annotation.",
                    CubeDockerFile.class.getSimpleName(), methodWithCubeDockerFile));
        }

        // User has defined @CubeDockerfile and @Image
        if ((classHasMethodWithCubeDockerFile || classDefinesCubeDockerFile) && classDefinesImage) {
            throw new IllegalArgumentException(
                String.format("Container Object %s has defined %s annotation and %s annotation together.",
                    containerObjectClass.getSimpleName(), Image.class.getSimpleName(),
                    CubeDockerFile.class.getSimpleName()));
        }

        // User has not defined either @CubeDockerfile or @Image
        if (!classDefinesCubeDockerFile && !classDefinesImage && !classHasMethodWithCubeDockerFile) {
            throw new IllegalArgumentException(
                String.format("Container Object %s is not annotated with either %s or %s annotations.",
                    containerObjectClass.getName(), CubeDockerFile.class.getSimpleName(), Image.class.getSimpleName()));
        }

        return this;
    }