<commit_before>/*******************************************************************************
 * Copyright (c) 2004 - 2006 University Of British Columbia 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:
 *     University Of British Columbia - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylar.internal.tasks.ui.wizards;

import org.eclipse.jface.wizard.Wizard;
import org.eclipse.mylar.internal.tasks.ui.TaskListImages;
import org.eclipse.mylar.internal.tasks.ui.search.AbstractRepositoryQueryPage;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;

/**
 * @author <NAME>
 */
public abstract class AbstractEditQueryWizard extends Wizard {

	private static final String TITLE = "Edit Repository Query";

	protected final TaskRepository repository;

	protected AbstractRepositoryQuery query;
	
	protected AbstractRepositoryQueryPage page;
	
	public AbstractEditQueryWizard(TaskRepository repository, AbstractRepositoryQuery query) {
		this.repository = repository;
		this.query = query;
		setNeedsProgressMonitor(true);
		setWindowTitle(TITLE);
		setDefaultPageImageDescriptor(TaskListImages.BANNER_REPOSITORY);
	}

	@Override
	public boolean performFinish() {
		AbstractRepositoryQuery query = page.getQuery();
		if (query != null) {
			
			TasksUiPlugin.getTaskListManager().getTaskList().deleteQuery(query);
			TasksUiPlugin.getTaskListManager().getTaskList().addQuery(query);
			
			AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(repository.getKind());
			if (connector != null) {
				TasksUiPlugin.getSynchronizationManager().synchronize(connector, query, null);
			}
		} 

		return true;
	}
}<commit_msg>NEW - bug 162651: support search integration for JIRA https://bugs.eclipse.org/bugs/show_bug.cgi?id=162651<commit_after>/*******************************************************************************
 * Copyright (c) 2004 - 2006 University Of British Columbia 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:
 *     University Of British Columbia - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylar.internal.tasks.ui.wizards;

import org.eclipse.jface.wizard.Wizard;
import org.eclipse.mylar.internal.tasks.ui.TaskListImages;
import org.eclipse.mylar.internal.tasks.ui.search.AbstractRepositoryQueryPage;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;

/**
 * @author <NAME>
 */
public abstract class AbstractEditQueryWizard extends Wizard {

	private static final String TITLE = "Edit Repository Query";

	protected final TaskRepository repository;

	protected AbstractRepositoryQuery query;

	protected AbstractRepositoryQueryPage page;

	public AbstractEditQueryWizard(TaskRepository repository, AbstractRepositoryQuery query) {
		this.repository = repository;
		this.query = query;
		setNeedsProgressMonitor(true);
		setWindowTitle(TITLE);
		setDefaultPageImageDescriptor(TaskListImages.BANNER_REPOSITORY);
	}

	@Override
	public boolean performFinish() {
		AbstractRepositoryQuery queryToRun = null;
		if (page != null) {
			// TODO: get rid of this?
			queryToRun = page.getQuery();
		} else {
			queryToRun = this.query;
		}
		if (queryToRun != null) {
			TasksUiPlugin.getTaskListManager().getTaskList().deleteQuery(queryToRun);
			TasksUiPlugin.getTaskListManager().getTaskList().addQuery(queryToRun);

			AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
					repository.getKind());
			if (connector != null) {
				TasksUiPlugin.getSynchronizationManager().synchronize(connector, queryToRun, null);
			}
		}

		return true;
	}
}
{'fraction_non_alphanumeric': 0.15677220756376428, 'fraction_numerical': 0.0079155672823219, 'mean_word_length': 5.679882525697503, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1924770', 'n_tokens_mistral': 1311, 'n_tokens_neox': 1191, 'n_words': 276}