Package de.uni_mannheim.swt.codeconjurer.domain.search

Examples of de.uni_mannheim.swt.codeconjurer.domain.search.Search


            StringBuilder message = new StringBuilder();
            if (msg.equals("")) {
              if (noServer || noUsername || noPassword) {
                message.append("Please set up preferences first. Go to Eclipse -> Preferences -> Code Conjurer.");
              } else {
                Search search = CodeConjurer.getInstance()
                    .getActiveEditorSearch();
                ActionContributionItem showAdapterAction = (ActionContributionItem) getViewSite()
                    .getActionBars()
                    .getToolBarManager()
                    .find("de.uni_mannheim.swt.codeconjurer.showAdapterAction");

                if (search != null) {
                  Result result = null;
                  int results = 0;
                  switch (search.getKind()) {
                  case Search.STANDARD_SEARCH:
                    showAdapterAction.getAction()
                        .setEnabled(false);
                    result = search.getSearchResult();
                    results = result.getResultItems().length;
                    if (results > 0) {
                      message.append(results
                          + " results found. "
                          + result.getNumberOfSuccessfullyFetchedSources()
                          + " items successfully downloaded. :: Result created "
                          + result.getCreationDate());
                    }
                    break;

                  case Search.TEST_DRIVEN_SEARCH:
                    showAdapterAction.getAction()
                        .setEnabled(true);
                    result = search.getSearchResult();
                    int passes = result
                        .getNumberOfSuccessfulTests();
                    int retrieved = result
                        .getNumberOfSuccessfullyFetchedSources();
                    long time = search.getDuration();
                    String duration;
                    if (time / Math.pow(10, 9) < 120) {
                      duration = String.valueOf(time
                          / Math.pow(10, 9));
                      duration = duration.substring(0,
                          duration.indexOf("."));
                      duration += " s";
                    } else {
                      duration = String
                          .valueOf((time / Math.pow(
                              10, 9)) / 60);
                      duration = duration.substring(0,
                          duration.indexOf(".") + 2);
                      duration += " min";
                    }
                    results = result.getResultItems().length;
                    if (search.getState() == Job.RUNNING) {
                      message.append("Testing in progress");
                      message.append(" :: Time elapsed "
                          + duration);
                    }
                    if (retrieved > 0) {
                      message.append(" :: "
                          + passes
                          + " of "
                          + results
                          + " candidates passed test. "
                          + retrieved
                          + " items successfully downloaded.");
                      if (search.isFinished()) {
                        message.append(" :: Result created "
                            + result.getCreationDate());
                        message.append(" :: Result created in "
                            + duration);
                      }
View Full Code Here


        String message = "";
        if (msg.equals("")) {
          if (noServer || noUsername || noPassword) {
            message = "Please setup preferences first. Go to Eclipse -> Preferences -> Code Conjurer.";
          } else {
            Search search = CodeConjurer.getInstance()
                .getActiveSearch();

            if (search != null) {
              Result result = search.getSearchResult();
              int results = result.getResultItems().length;
              if (results > 0) {
                message = (results
                    + " Results Found. "
                    + result.getNumberOfSuccessfullyFetchedSources()
View Full Code Here

    display.asyncExec(new Runnable() {
      @Override
      public void run() {
        logger.debug("Refresh " + treeViewer);
        if (treeViewer != null) {
          Search oldInput = (Search) treeViewer.getInput();
          Search newInput = CodeConjurer.getInstance()
              .getActiveSearch();
          Tree tree = treeViewer.getTree();
          if (tree != null && !tree.isDisposed()) {
            TreeItem[] selection = tree.getSelection();
            Object[] expandedElements = treeViewer
View Full Code Here

   * org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.
   * Object)
   */
  @Override
  public Object[] getElements(Object inputElement) {
    Search search = (Search) inputElement;
    ResultItem[] results = search.getSearchResult().getResultItems();
    boolean noShowNegatives = false;
    ArrayList<BodyDeclaration> elements = new ArrayList<BodyDeclaration>();
    if (search.getKind() == Search.TEST_DRIVEN_SEARCH) {
      // Remove failed candidates from result view if not requested.
      if (!Activator.getDefault().getPreferenceStore()
          .getBoolean(PreferenceConstants.P_SHOW_NEGATIVES)) {
        noShowNegatives = true;
      }
View Full Code Here

        String message = "";
        if (msg.equals("")) {
          if (noServer || noUsername || noPassword) {
            message = "Please setup preferences first. Go to Eclipse -> Preferences -> Code Conjurer.";
          } else {
            Search search = CodeConjurer.getInstance()
                .getActiveSearch();

            if (search != null) {
              Result result = search.getSearchResult();
              int results = result.getResultItems().length;
              if (results > 0) {
                message = (results
                    + " Results Found. "
                    + result.getNumberOfSuccessfullyFetchedSources()
View Full Code Here

   * org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.
   * Object)
   */
  @Override
  public Object[] getElements(Object inputElement) {
    Search search = (Search) inputElement;
    ResultItem[] results = search.getSearchResult().getResultItems();
    ArrayList<BodyDeclaration> elements = new ArrayList<BodyDeclaration>();
    for (ResultItem result : results) {
      BodyDeclaration typeRoot = result.getTypeRoot();
      if (typeRoot != null)
        elements.add(typeRoot);
View Full Code Here

    display.asyncExec(new Runnable() {
      @Override
      public void run() {
        logger.debug("Refresh " + treeViewer);
        if (treeViewer != null) {
          Search oldInput = (Search) treeViewer.getInput();
          Search newInput = CodeConjurer.getInstance()
              .getActiveSearch();
          Tree tree = treeViewer.getTree();
          if (tree != null && !tree.isDisposed()) {
            TreeItem[] selection = tree.getSelection();
            Object[] expandedElements = treeViewer
View Full Code Here

    display.asyncExec(new Runnable() {
      @Override
      public void run() {
        logger.debug("Refresh " + treeViewer);
        if (treeViewer != null) {
          Search oldInput = (Search) treeViewer.getInput();
          Search newInput = CodeConjurer.getInstance()
              .getActiveSearch();
          Tree tree = treeViewer.getTree();
          if (tree != null && !tree.isDisposed()) {
            TreeItem[] selection = tree.getSelection();
            Object[] expandedElements = treeViewer
View Full Code Here

  @Override
  protected IStatus run(IProgressMonitor monitor) {
    try {
      IPackageFragment pkg = (IPackageFragment) target;
      String uri = new String(source);
      Search search = CodeConjurer.getInstance().getActiveEditorSearch();
      BodyDeclaration selectedElement = search.getSearchResult()
          .find(uri);
      if (selectedElement.getNodeType() == BodyDeclaration.TYPE_DECLARATION) {
        TypeDeclaration typeDec = (TypeDeclaration) selectedElement;
        String name = typeDec.getName().toString();
        String sourceCode = (String) selectedElement
View Full Code Here

    display.asyncExec(new Runnable() {
      @Override
      public void run() {
        if (treeViewer != null) {
          logger.debug("Update TreeViewer");
          Search oldInput = (Search) treeViewer.getInput();
          Search newInput = CodeConjurer.getInstance()
              .getActiveEditorSearch();
          Tree tree = treeViewer.getTree();
          if (tree != null && !tree.isDisposed()) {
            TreeItem[] selection = tree.getSelection();
            Object[] expandedElements = treeViewer
                .getExpandedElements();
            if (newInput != oldInput) {
              treeViewer.setInput(newInput);
            } else {
              newInput = null;
            }
            treeViewer.refresh();
            // If there is no input we are finished.
            if (newInput == null) {
              return;
            } else {
              // Create tree and show test result row if a test
              // driven search was performed
              if (newInput.getKind() != Search.TEST_DRIVEN_SEARCH) {
                colTested.setWidth(0);
                colTested.setResizable(false);
              } else {
                colTested.setWidth(80);
                colTested.setResizable(true);
View Full Code Here

TOP

Related Classes of de.uni_mannheim.swt.codeconjurer.domain.search.Search

Copyright © 2018 www.massapicom. 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.