// Path: core/src/com/google/appraise/eclipse/core/AppraiseConnectorPlugin.java
// public class AppraiseConnectorPlugin extends Plugin {
//   /**
//    * The global plugin instance.
//    */
//   public static AppraiseConnectorPlugin plugin;
// 
//   /**
//    * The plugin id.
//    */
//   public static final String PLUGIN_ID = "com.google.appraise.eclipse.core";
// 
//   /**
//    * The type of the connector.
//    */
//   public static final String CONNECTOR_KIND = "com.google.appraise";
// 
//   /**
//    * Connector query attribute for the user as review requestor.
//    */
//   public static final String QUERY_REQUESTER = PLUGIN_ID + ".requestor";
// 
//   /**
//    * Connector query attribute for the user as reviewer.
//    */
//   public static final String QUERY_REVIEWER = PLUGIN_ID + ".reviewer";
// 
//   /**
//    * Connector query attribute for the review commit hash prefix.
//    */
//   public static final String QUERY_REVIEW_COMMIT_PREFIX = PLUGIN_ID + ".reviewcommitprefix";
// 
//   private static BundleContext context;
// 
//   static BundleContext getContext() {
//     return context;
//   }
// 
//   @Override
//   public void start(BundleContext bundleContext) throws Exception {
//     super.start(bundleContext);
//     plugin = this;
//   }
// 
//   @Override
//   public void stop(BundleContext bundleContext) throws Exception {
//     plugin = null;
//     super.stop(bundleContext);
//   }
// 
//   /**
//    * Returns the shared instance.
//    */
//   public static AppraiseConnectorPlugin getDefault() {
//     return plugin;
//   }
// 
//   public static void logError(final String message, final Throwable throwable) {
//     getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, throwable));
//   }
// 
//   public static void logWarning(final String message, final Throwable throwable) {
//     getDefault().getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, throwable));
//   }
// }


import com.google.appraise.eclipse.core.AppraiseConnectorPlugin;
import org.eclipse.mylyn.commons.workbench.forms.SectionComposite;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage2;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
/*******************************************************************************
 * Copyright (c) 2015 Google and others.
 * 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
 *
 * Contributors:
 *     Scott McMaster - initial implementation
 *******************************************************************************/
package com.google.appraise.eclipse.ui;



/**
 * Custom Appraise review query page.
 */
public class AppraiseReviewsQueryPage extends AbstractRepositoryQueryPage2 {
  private Button requesterCheckbox;
  private Button reviewerCheckbox;
  private Text reviewCommitPrefixText;

  public AppraiseReviewsQueryPage(TaskRepository repository, IRepositoryQuery query) {
    super("reviews", repository, query);
    setTitle("Appraise Review Search");
    setDescription("Specify search parameters.");
  }

  @Override
  protected void createPageContent(SectionComposite parent) {
    Composite composite = parent.getContent();
    composite.setLayout(new GridLayout(2, false));
    requesterCheckbox = new Button(composite, SWT.CHECK);
    requesterCheckbox.setText("Requester");
    reviewerCheckbox = new Button(composite, SWT.CHECK);
    reviewerCheckbox.setText("Reviewer");

    Label reviewCommitPrefixLabel = new Label(composite, SWT.NONE);
    reviewCommitPrefixLabel.setText("Review Commit Hash (prefix):");
    reviewCommitPrefixText = new Text(composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    composite.pack();
  }

  @Override
  protected boolean hasRepositoryConfiguration() {
    return true;
  }

  @Override
  protected boolean restoreState(IRepositoryQuery query) {
// Path: core/src/com/google/appraise/eclipse/core/AppraiseConnectorPlugin.java
// public class AppraiseConnectorPlugin extends Plugin {
//   /**
//    * The global plugin instance.
//    */
//   public static AppraiseConnectorPlugin plugin;
// 
//   /**
//    * The plugin id.
//    */
//   public static final String PLUGIN_ID = "com.google.appraise.eclipse.core";
// 
//   /**
//    * The type of the connector.
//    */
//   public static final String CONNECTOR_KIND = "com.google.appraise";
// 
//   /**
//    * Connector query attribute for the user as review requestor.
//    */
//   public static final String QUERY_REQUESTER = PLUGIN_ID + ".requestor";
// 
//   /**
//    * Connector query attribute for the user as reviewer.
//    */
//   public static final String QUERY_REVIEWER = PLUGIN_ID + ".reviewer";
// 
//   /**
//    * Connector query attribute for the review commit hash prefix.
//    */
//   public static final String QUERY_REVIEW_COMMIT_PREFIX = PLUGIN_ID + ".reviewcommitprefix";
// 
//   private static BundleContext context;
// 
//   static BundleContext getContext() {
//     return context;
//   }
// 
//   @Override
//   public void start(BundleContext bundleContext) throws Exception {
//     super.start(bundleContext);
//     plugin = this;
//   }
// 
//   @Override
//   public void stop(BundleContext bundleContext) throws Exception {
//     plugin = null;
//     super.stop(bundleContext);
//   }
// 
//   /**
//    * Returns the shared instance.
//    */
//   public static AppraiseConnectorPlugin getDefault() {
//     return plugin;
//   }
// 
//   public static void logError(final String message, final Throwable throwable) {
//     getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, throwable));
//   }
// 
//   public static void logWarning(final String message, final Throwable throwable) {
//     getDefault().getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, throwable));
//   }
// }


// Path: ui/src/com/google/appraise/eclipse/ui/AppraiseReviewsQueryPage.java
import com.google.appraise.eclipse.core.AppraiseConnectorPlugin;
import org.eclipse.mylyn.commons.workbench.forms.SectionComposite;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage2;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;

/*******************************************************************************
 * Copyright (c) 2015 Google and others.
 * 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
 *
 * Contributors:
 *     Scott McMaster - initial implementation
 *******************************************************************************/
package com.google.appraise.eclipse.ui;



/**
 * Custom Appraise review query page.
 */
public class AppraiseReviewsQueryPage extends AbstractRepositoryQueryPage2 {
  private Button requesterCheckbox;
  private Button reviewerCheckbox;
  private Text reviewCommitPrefixText;

  public AppraiseReviewsQueryPage(TaskRepository repository, IRepositoryQuery query) {
    super("reviews", repository, query);
    setTitle("Appraise Review Search");
    setDescription("Specify search parameters.");
  }

  @Override
  protected void createPageContent(SectionComposite parent) {
    Composite composite = parent.getContent();
    composite.setLayout(new GridLayout(2, false));
    requesterCheckbox = new Button(composite, SWT.CHECK);
    requesterCheckbox.setText("Requester");
    reviewerCheckbox = new Button(composite, SWT.CHECK);
    reviewerCheckbox.setText("Reviewer");

    Label reviewCommitPrefixLabel = new Label(composite, SWT.NONE);
    reviewCommitPrefixLabel.setText("Review Commit Hash (prefix):");
    reviewCommitPrefixText = new Text(composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    composite.pack();
  }

  @Override
  protected boolean hasRepositoryConfiguration() {
    return true;
  }

  @Override
  protected boolean restoreState(IRepositoryQuery query) {
    String requester = query.getAttribute(AppraiseConnectorPlugin.QUERY_REQUESTER);