Examples of usage


Examples of com.bungleton.yarrgs.Usage

    }

    protected String getDetail ()
    {
        StringBuilder help = new StringBuilder();
        Usage commandUsage = _argumentHolder.getAnnotation(Usage.class);
        if (commandUsage != null) {
            Argument.wrap(help, commandUsage.value(), 2).append("\n\n");
        }
        if (!_orderedOptions.isEmpty()) {
            help.append("Options:\n");
            for (OptionArgument option : _orderedOptions) {
                help.append(option.getDetail()).append('\n');
View Full Code Here

Examples of com.bungleton.yarrgs.Usage

        this.field = field;
    }

    public String getUsage ()
    {
        Usage u = field.getAnnotation(Usage.class);
        return u == null ? "" : u.value();
    }
View Full Code Here

Examples of com.cloud.hypervisor.kvm.resource.LibvirtSecretDef.usage

public class LibvirtSecretDefTest extends TestCase {

    public void testVolumeSecretDef() {
        String uuid = "db66f42b-a79e-4666-9910-9dfc8a024427";
        String name = "myEncryptedQCOW2";
        usage use = usage.VOLUME;

        LibvirtSecretDef def = new LibvirtSecretDef(use, uuid);
        def.setVolumeVolume(name);

        String expectedXml = "<secret ephemeral='no' private='no'>\n<uuid>" + uuid + "</uuid>\n" +
                             "<usage type='" + use.toString() + "'>\n<volume>" + name + "</volume>\n</usage>\n</secret>\n";

        assertEquals(expectedXml, def.toString());
    }
View Full Code Here

Examples of com.cloud.hypervisor.kvm.resource.LibvirtSecretDef.usage

    }

    public void testCephSecretDef() {
        String uuid = "a9febe83-ac5c-467a-bf19-eb75325ec23c";
        String name = "admin";
        usage use = usage.CEPH;

        LibvirtSecretDef def = new LibvirtSecretDef(use, uuid);
        def.setCephName(name);

        String expectedXml = "<secret ephemeral='no' private='no'>\n<uuid>" + uuid + "</uuid>\n" +
                             "<usage type='" + use.toString() + "'>\n<name>" + name + "</name>\n</usage>\n</secret>\n";

        assertEquals(expectedXml, def.toString());
    }
View Full Code Here

Examples of com.datasift.client.core.Usage

            case DAY:
            default:
                period = "day";
        }
        URI uri = newParams().put("period", period).forURL(config.newAPIEndpointURI(USAGE));
        Request request = config.http().GET(uri, new PageReader(newRequestCallback(future, new Usage(), config)));
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

Examples of com.datasift.client.core.Usage

            case DAY:
            default:
                period = "day";
        }
        URI uri = newParams().put("period", period).forURL(config.newAPIEndpointURI(USAGE));
        Request request = config.http().GET(uri, new PageReader(newRequestCallback(future, new Usage(), config)));
        performRequest(future, request);
        return future;
    }
View Full Code Here

Examples of com.datasift.client.core.Usage

    }

    @Test
    public void testIfObjectsProcessedAndDelivered() {

        Usage usage = datasift.usage().sync();

        assertTrue(usage.isSuccessful());

//        assertEquals(usage.getEnd().getMillis(), end.getMillis());
//        assertEquals(usage.getStart().getMillis(), start.getMillis());

        assertEquals(usage.getStreams().getSeconds(), streams.get("seconds"));

        for (String key : usage.getStreams().getLicenses().keySet()) {
            if (!streams.containsKey(key)) {
                throw new AssertionError("The licenses map keys are not the same");
            }

            if (!streams.get(key).equals(usage.getStreams().getLicenses().get(key))) {
                throw new AssertionError("The licenses map values are not the same");
            }
        }
    }
View Full Code Here

Examples of com.intellij.usages.Usage

  @Override
  public Component getTableCellRendererComponent(JTable list, Object value, boolean isSelected,
      boolean hasFocus, int row, int column) {
    UsageNode usageNode = value instanceof UsageNode ? (UsageNode) value : null;

    Usage usage = usageNode == null ? null : usageNode.getUsage();

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
    Color fileBgColor = getBackgroundColor(isSelected, usage);
    final Color bg = UIUtil.getListSelectionBackground();
    final Color fg = UIUtil.getListSelectionForeground();
    panel.setBackground(isSelected ? bg : fileBgColor == null ? list.getBackground() : fileBgColor);
    panel.setForeground(isSelected ? fg : list.getForeground());

    if (usage == null || usageNode instanceof ShowUsagesAction.StringNode) {
      panel.setLayout(new BorderLayout());
      if (column == 0) {
        panel.add(
            new JLabel("<html><body><b>" + value + "</b></body></html>", SwingConstants.CENTER));
      }
      return panel;
    }

    SimpleColoredComponent textChunks = new SimpleColoredComponent();
    textChunks.setIpad(new Insets(0, 0, 0, 0));
    textChunks.setBorder(null);

    if (column == 0) {
      GroupNode parent = (GroupNode) usageNode.getParent();
      appendGroupText(parent, panel, fileBgColor);
      if (usage == ShowUsagesAction.MORE_USAGES_SEPARATOR) {
        textChunks.append("...<");
        textChunks.append("more usages", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
        textChunks.append(">...");
      }
    } else if (usage != ShowUsagesAction.MORE_USAGES_SEPARATOR) {
      UsagePresentation presentation = usage.getPresentation();
      TextChunk[] text = presentation.getText();

      if (column == 1) {
        final Icon icon = presentation.getIcon();
        textChunks.setIcon(icon == null ? EmptyIcon.ICON_16 : icon);
View Full Code Here

Examples of com.intellij.usages.Usage

          if (visibleNodes.size() >= maxUsages) return false;
          if (UsageViewManager.isSelfUsage(usage, new UsageTarget[] { myUsageTarget })) {
            return true;
          }

          Usage usageToAdd = decider.shouldShow(myUsageTarget, usage) ? usage : null;
          if (usageToAdd == null) return true;

          UsageNode node = usageView.doAppendUsage(usageToAdd);
          usages.add(usageToAdd);

          if (node != null) {
            visibleNodes.add(node);
            boolean continueSearch = true;
            if (visibleNodes.size() == maxUsages) {
              visibleNodes.add(MORE_USAGES_SEPARATOR_NODE);
              usages.add(MORE_USAGES_SEPARATOR);
              continueSearch = false;
            }
            pingEDT.ping();

            return continueSearch;
          }

          return true;
        }
      }
    };

    final ProgressIndicator indicator =
        FindUsagesManager.startProcessUsages(handler, handler.getPrimaryElements(),
            handler.getSecondaryElements(), collect, options, new Runnable() {
              @Override
              public void run() {
                ApplicationManager.getApplication().invokeLater(new Runnable() {
                  @Override
                  public void run() {
                    Disposer.dispose(processIcon);
                    Container parent = processIcon.getParent();
                    parent.remove(processIcon);
                    parent.repaint();
                    pingEDT.ping(); // repaint title
                    synchronized (usages) {
                      if (visibleNodes.isEmpty()) {
                        if (usages.isEmpty()) {
                          String text = UsageViewBundle.message("no.usages.found.in",
                              searchScopePresentableName(options, project));
                          showHint(text, editor, popupPosition, handler, maxUsages, options);
                          popup.cancel();
                        } else {
                          // all usages filtered out
                        }
                      } else if (visibleNodes.size() == 1) {
                        if (usages.size() == 1) {
                          //the only usage
                          Usage usage = visibleNodes.iterator().next().getUsage();
                          usage.navigate(true);
                          //String message = UsageViewBundle.message("show.usages.only.usage", searchScopePresentableName(options, project));
                          //navigateAndHint(usage, message, handler, popupPosition, maxUsages, options);
                          popup.cancel();
                        } else {
                          assert usages.size() > 1 : usages;
                          // usage view can filter usages down to one
                          Usage visibleUsage = visibleNodes.iterator().next().getUsage();
                          if (areAllUsagesInOneLine(visibleUsage, usages)) {
                            String hint = UsageViewBundle.message("all.usages.are.in.this.line",
                                usages.size(), searchScopePresentableName(options, project));
                            navigateAndHint(visibleUsage, hint, handler, popupPosition, maxUsages,
                                options);
View Full Code Here

Examples of com.intellij.usages.Usage

      public void run() {
        int[] selected = table.getSelectedRows();
        for (int i : selected) {
          Object value = table.getValueAt(i, 0);
          if (value instanceof UsageNode) {
            Usage usage = ((UsageNode) value).getUsage();
            if (usage == MORE_USAGES_SEPARATOR) {
              appendMoreUsages(editor, popupPosition, handler, maxUsages);
              return;
            }
            navigateAndHint(usage, null, handler, popupPosition, maxUsages, options);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.