diff options
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.ui/src')
39 files changed, 0 insertions, 6523 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaImages.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaImages.java deleted file mode 100644 index b49311aee..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaImages.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.graphics.Image; - -/** - * @author Shawn Minto - * @author Mik Kersten - */ -public class BugzillaImages { - - private static ImageRegistry imageRegistry; - - private static final URL baseURL = BugzillaUiPlugin.getDefault().getBundle().getEntry("/icons/"); //$NON-NLS-1$ - - public static final String T_ELCL = "elcl16"; //$NON-NLS-1$ - - public static final String T_TOOL = "etool16"; //$NON-NLS-1$ - - public static final String T_VIEW = "eview16"; //$NON-NLS-1$ - - public static final ImageDescriptor OVERLAY_BUGZILLA = create(T_VIEW, "overlay-bugzilla.gif"); //$NON-NLS-1$ - - public static final ImageDescriptor BUG = create(T_ELCL, "bug.gif"); //$NON-NLS-1$ - - public static final ImageDescriptor BUG_COMMENT = create(T_ELCL, "bug-comment.gif"); //$NON-NLS-1$ - - public static final ImageDescriptor REMOVE_ALL = create("", "remove-all.gif"); //$NON-NLS-1$ //$NON-NLS-2$ - - public static final ImageDescriptor REMOVE = create("", "remove.gif"); //$NON-NLS-1$ //$NON-NLS-2$ - - public static final ImageDescriptor SELECT_ALL = create("", "selectAll.gif"); //$NON-NLS-1$ //$NON-NLS-2$ - - public static final ImageDescriptor OPEN = create("", "openresult.gif"); //$NON-NLS-1$ //$NON-NLS-2$ - - public static final ImageDescriptor OVERLAY_CRITICAL = create(T_VIEW, "overlay-critical.gif"); //$NON-NLS-1$ - - public static final ImageDescriptor OVERLAY_MAJOR = create(T_VIEW, "overlay-major.gif"); //$NON-NLS-1$ - - public static final ImageDescriptor OVERLAY_ENHANCEMENT = create(T_VIEW, "overlay-enhancement.gif"); //$NON-NLS-1$ - - public static final ImageDescriptor OVERLAY_MINOR = create(T_VIEW, "overlay-minor.gif"); //$NON-NLS-1$ - - private static ImageDescriptor create(String prefix, String name) { - try { - return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name)); - } catch (MalformedURLException e) { - return ImageDescriptor.getMissingImageDescriptor(); - } - } - - private static URL makeIconFileURL(String prefix, String name) throws MalformedURLException { - if (baseURL == null) { - throw new MalformedURLException(); - } - - StringBuffer buffer = new StringBuffer(prefix); - if (prefix != "") { //$NON-NLS-1$ - buffer.append('/'); - } - buffer.append(name); - return new URL(baseURL, buffer.toString()); - } - - private static ImageRegistry getImageRegistry() { - if (imageRegistry == null) { - imageRegistry = new ImageRegistry(); - } - - return imageRegistry; - } - - /** - * Lazily initializes image map. - */ - public static Image getImage(ImageDescriptor imageDescriptor) { - ImageRegistry imageRegistry = getImageRegistry(); - Image image = imageRegistry.get("" + imageDescriptor.hashCode()); //$NON-NLS-1$ - if (image == null) { - image = imageDescriptor.createImage(); - imageRegistry.put("" + imageDescriptor.hashCode(), image); //$NON-NLS-1$ - } - return image; - } -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaSearchHandler.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaSearchHandler.java deleted file mode 100644 index ee80ad0d4..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaSearchHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; - -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; -import org.eclipse.mylyn.internal.tasks.core.AbstractSearchHandler; -import org.eclipse.mylyn.tasks.core.IRepositoryQuery; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.core.data.TaskData; - -/** - * @author Robert Elves - */ -@SuppressWarnings("restriction") -public class BugzillaSearchHandler extends AbstractSearchHandler { - - @Override - public String getConnectorKind() { - return BugzillaCorePlugin.CONNECTOR_KIND; - } - - @Override - public boolean queryForText(TaskRepository taskRepository, IRepositoryQuery query, TaskData taskData, - String searchString) { - try { - String queryUrl = taskRepository.getRepositoryUrl() - + "/buglist.cgi?long_desc_type=allwordssubstr&long_desc=" //$NON-NLS-1$ - + URLEncoder.encode(searchString, taskRepository.getCharacterEncoding()); - query.setUrl(queryUrl); - } catch (UnsupportedEncodingException e) { - return false; - } - return true; - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiExtensionReader.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiExtensionReader.java deleted file mode 100644 index 26bfa2dd3..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiExtensionReader.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Frank Becker 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: - * Frank Becker - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.mylyn.commons.core.StatusHandler; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaLanguageSettings; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector; - -/** - * @author Frank Becker - */ -public class BugzillaUiExtensionReader { - - public static final String EXTENSION_LANGUAGES = "org.eclipse.mylyn.bugzilla.core.languages"; //$NON-NLS-1$ - - public static final String EXTENSION_TMPL_LANGUAGE = "language"; //$NON-NLS-1$ - - public static final String ATTR_LANG_VALUE = "value"; //$NON-NLS-1$ - - public static final String ELMNT_LANG_NAME = "name"; //$NON-NLS-1$ - - public static final String ELMNT_LANG_ERROR_LOGIN = "error_login"; //$NON-NLS-1$ - - public static final String ELMNT_LANG_ERROR_COLLISION = "error_collision"; //$NON-NLS-1$ - - public static final String ELMNT_LANG_ERROR_COMMENT_REQIRED = "error_comment_required"; //$NON-NLS-1$ - - public static final String ELMNT_LANG_ERROR_LOGGED_OUT = "error_logged_out"; //$NON-NLS-1$ - - public static final String ELMNT_LANG_BAD_LOGIN = "bad_login"; //$NON-NLS-1$ - - public static final String ELMNT_LANG_PROCESSED = "processed"; //$NON-NLS-1$ - - public static final String ELMNT_LANG_CHANGES_SUBMITTED = "changes_submitted"; //$NON-NLS-1$ - - private static boolean coreExtensionsRead = false; - - public static void initStartupExtensions() { - if (!coreExtensionsRead) { - IExtensionRegistry registry = Platform.getExtensionRegistry(); - - IExtensionPoint templatesExtensionPoint = registry.getExtensionPoint(EXTENSION_LANGUAGES); - IExtension[] templateExtensions = templatesExtensionPoint.getExtensions(); - for (IExtension templateExtension : templateExtensions) { - IConfigurationElement[] elements = templateExtension.getConfigurationElements(); - for (IConfigurationElement element : elements) { - if (element.getName().equals(EXTENSION_TMPL_LANGUAGE)) { - readLanguageTemplate(element); - } - } - } - - coreExtensionsRead = true; - } - - } - - private static void readLanguageTemplate(IConfigurationElement element) { - String languageName = element.getAttribute(ELMNT_LANG_NAME); - if (languageName != null) { - BugzillaLanguageSettings bugzillaLanguageSettings = new BugzillaLanguageSettings(languageName); - - for (IConfigurationElement configElement : element.getChildren()) { - String name = configElement.getName(); - if (name != null && name.equals("languageAttribute")) { //$NON-NLS-1$ - String command = configElement.getAttribute("command"); //$NON-NLS-1$ - String response = configElement.getAttribute("response"); //$NON-NLS-1$ - bugzillaLanguageSettings.addLanguageAttribute(command, response); - } - } - BugzillaRepositoryConnector.addLanguageSetting(bugzillaLanguageSettings); - } else { - StatusHandler.log(new Status(IStatus.WARNING, BugzillaUiPlugin.ID_PLUGIN, - "Could not load language template extension " + element.getName())); //$NON-NLS-1$ - } - } -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java deleted file mode 100644 index 4c5248a69..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java +++ /dev/null @@ -1,242 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector; -import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; -import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration; -import org.eclipse.mylyn.tasks.ui.TasksUi; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The main plugin class to be used in the desktop. - * - * @author Mik Kersten - */ -public class BugzillaUiPlugin extends AbstractUIPlugin { - - public static final String ID_PLUGIN = "org.eclipse.mylyn.bugzilla.ui"; //$NON-NLS-1$ - - public static final String SEARCH_PAGE_ID = BugzillaUiPlugin.ID_PLUGIN + ".search.bugzillaSearchPage"; //$NON-NLS-1$ - - public static final String SEARCH_PAGE_CONTEXT = BugzillaUiPlugin.ID_PLUGIN + ".bugzillaSearchContext"; //$NON-NLS-1$ - - public static final String EDITOR_PAGE_CONTEXT = BugzillaUiPlugin.ID_PLUGIN + ".bugzillaEditorContext"; //$NON-NLS-1$ - - // The is's for hit markers used in the label provider and sorters - public static final String HIT_MARKER_ATTR_ID = "taskId"; //$NON-NLS-1$ - - public static final String HIT_MARKER_ATTR_REPOSITORY = "repository"; //$NON-NLS-1$ - - public static final String HIT_MARKER_ATTR_HREF = "href"; //$NON-NLS-1$ - - public static final String HIT_MARKER_ATTR_DESC = "summary"; //$NON-NLS-1$ - - public static final String HIT_MARKER_ATTR_LABEL = "label"; //$NON-NLS-1$ - - public static final String HIT_MARKER_ATTR_SEVERITY = "severity"; //$NON-NLS-1$ - - public static final String HIT_MARKER_ATTR_PRIORITY = "priority"; //$NON-NLS-1$ - - public static final String HIT_MARKER_ATTR_PLATFORM = "platform"; //$NON-NLS-1$ - - public static final String HIT_MARKER_ATTR_STATE = "state"; //$NON-NLS-1$ - - public static final String HIT_MARKER_ATTR_RESULT = "result"; //$NON-NLS-1$ - - public static final String HIT_MARKER_ATTR_OWNER = "owner"; //$NON-NLS-1$ - - public static final String HIT_MARKER_ATTR_QUERY = "query"; //$NON-NLS-1$ - - /** - * XXX: remove? - */ - public static final String HIT_MARKER_ID = BugzillaUiPlugin.ID_PLUGIN + ".searchHit"; //$NON-NLS-1$ - - private static BugzillaUiPlugin plugin; - - public static final char PREF_DELIM_REPOSITORY = ':'; - - private static final int WRAP_LENGTH = 90; - - @SuppressWarnings("restriction") - public BugzillaUiPlugin() { - plugin = this; - org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin.getDefault().addSearchHandler(new BugzillaSearchHandler()); - } - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - getPreferenceStore().setDefault(IBugzillaConstants.MAX_RESULTS, 100); - - IPath repConfigCacheFile = getProductConfigurationCachePath(); - if (repConfigCacheFile != null) { - BugzillaCorePlugin.setConfigurationCacheFile(repConfigCacheFile.toFile()); - } - - BugzillaRepositoryConnector bugzillaConnector = (BugzillaRepositoryConnector) TasksUi.getRepositoryManager() - .getRepositoryConnector(BugzillaCorePlugin.CONNECTOR_KIND); - - TasksUi.getRepositoryManager().addListener(bugzillaConnector.getClientManager()); - - // NOTE: initializing extensions in start(..) has caused race - // conditions previously - BugzillaUiExtensionReader.initStartupExtensions(); - } - - /** - * Returns the path to the file cacheing the product configuration. - */ - private static IPath getProductConfigurationCachePath() { - IPath stateLocation = Platform.getStateLocation(BugzillaCorePlugin.getDefault().getBundle()); - IPath configFile = stateLocation.append("repositoryConfigurations"); //$NON-NLS-1$ - return configFile; - } - - public int getMaxResults() { - return getPreferenceStore().getInt(IBugzillaConstants.MAX_RESULTS); - } - - /** - * This method is called when the plug-in is stopped - */ - @Override - public void stop(BundleContext context) throws Exception { - - BugzillaRepositoryConnector bugzillaConnector = (BugzillaRepositoryConnector) TasksUi.getRepositoryManager() - .getRepositoryConnector(BugzillaCorePlugin.CONNECTOR_KIND); - - TasksUi.getRepositoryManager().removeListener(bugzillaConnector.getClientManager()); - - super.stop(context); - plugin = null; - } - - /** - * Returns the shared instance. - */ - public static BugzillaUiPlugin getDefault() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given plug-in relative path. - * - * @param path - * the path - * @return the image descriptor - */ - public static ImageDescriptor getImageDescriptor(String path) { - return AbstractUIPlugin.imageDescriptorFromPlugin(ID_PLUGIN, path); - } - - public static String[] getQueryOptions(String prefId, String[] selectedProducts, - RepositoryConfiguration repositoryConfiguration) { - List<String> options = new ArrayList<String>(); - if ((prefId.equals(IBugzillaConstants.VALUES_COMPONENT) || prefId.equals(IBugzillaConstants.VALUES_VERSION) || prefId.equals(IBugzillaConstants.VALUES_TARGET)) - && selectedProducts != null) { - for (String product : selectedProducts) { - if (prefId.equals(IBugzillaConstants.VALUES_COMPONENT)) { - for (String option : repositoryConfiguration.getComponents(product)) { - if (!options.contains(option)) { - options.add(option); - } - } - } - if (prefId.equals(IBugzillaConstants.VALUES_VERSION)) { - for (String option : repositoryConfiguration.getVersions(product)) { - if (!options.contains(option)) { - options.add(option); - } - } - } - if (prefId.equals(IBugzillaConstants.VALUES_TARGET)) { - for (String option : repositoryConfiguration.getTargetMilestones(product)) { - if (!options.contains(option)) { - options.add(option); - } - } - } - } - } else { - if (prefId.equals(IBugzillaConstants.VALUES_COMPONENT)) { - options = repositoryConfiguration.getComponents(); - } - if (prefId.equals(IBugzillaConstants.VALUES_VERSION)) { - options = repositoryConfiguration.getVersions(); - } - if (prefId.equals(IBugzillaConstants.VALUES_TARGET)) { - options = repositoryConfiguration.getTargetMilestones(); - } - } - return options.toArray(new String[options.size()]); - } - - public static String getMostRecentQuery() { - return plugin.getPreferenceStore().getString(IBugzillaConstants.MOST_RECENT_QUERY); - } - - /** - * Break text up into lines so that it is displayed properly in bugzilla - * - * @deprecated use {@link BugzillaClient#formatTextToLineWrap(String, boolean)} instead - */ - @Deprecated - public static String formatTextToLineWrap(String origText, boolean hardWrap) { - // BugzillaServerVersion bugzillaServerVersion = - // IBugzillaConstants.BugzillaServerVersion.fromString(repository - // .getVersion()); - // if (bugzillaServerVersion != null && - // bugzillaServerVersion.compareTo(BugzillaServerVersion.SERVER_220) >= - // 0) { - // return origText; - if (!hardWrap) { - return origText; - } else { - String[] textArray = new String[(origText.length() / WRAP_LENGTH + 1) * 2]; - for (int i = 0; i < textArray.length; i++) { - textArray[i] = null; - } - int j = 0; - while (true) { - int spaceIndex = origText.indexOf(" ", WRAP_LENGTH - 5); //$NON-NLS-1$ - if (spaceIndex == origText.length() || spaceIndex == -1) { - textArray[j] = origText; - break; - } - textArray[j] = origText.substring(0, spaceIndex); - origText = origText.substring(spaceIndex + 1, origText.length()); - j++; - } - - String newText = ""; //$NON-NLS-1$ - - for (String element : textArray) { - if (element == null) { - break; - } - newText += element + "\n"; //$NON-NLS-1$ - } - return newText; - } - } -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaNotObsoleteAttachmentAction.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaNotObsoleteAttachmentAction.java deleted file mode 100644 index 9919b5cbf..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaNotObsoleteAttachmentAction.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.action; - -/** - * @author Frank Becker - */ -public class BugzillaNotObsoleteAttachmentAction extends BugzillaUpdateAttachmentAction { - - public BugzillaNotObsoleteAttachmentAction() { - super(false); - // ignore - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaObsoleteAttachmentAction.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaObsoleteAttachmentAction.java deleted file mode 100644 index c39f1f698..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaObsoleteAttachmentAction.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.action; - -/** - * @author Frank Becker - */ -public class BugzillaObsoleteAttachmentAction extends BugzillaUpdateAttachmentAction { - - public BugzillaObsoleteAttachmentAction() { - super(true); - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaUpdateAttachmentAction.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaUpdateAttachmentAction.java deleted file mode 100644 index 2d1736dcf..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaUpdateAttachmentAction.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.action; - -import java.util.List; - -import org.eclipse.core.runtime.jobs.IJobChangeEvent; -import org.eclipse.core.runtime.jobs.JobChangeAdapter; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.IMessageProvider; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.mylyn.internal.bugzilla.ui.editor.BugzillaTaskEditorPage; -import org.eclipse.mylyn.tasks.core.ITaskAttachment; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.ui.editors.TaskEditor; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.actions.BaseSelectionListenerAction; -import org.eclipse.ui.forms.editor.IFormPage; - -/** - * @author Frank Becker - */ -public class BugzillaUpdateAttachmentAction extends BaseSelectionListenerAction implements IViewActionDelegate { - - private ISelection currentSelection; - - private final boolean obsolete; - - public BugzillaUpdateAttachmentAction(boolean obsolete) { - super("UpdateAttachmentAction"); //$NON-NLS-1$ - this.obsolete = obsolete; - } - - public void init(IViewPart view) { - // ignore - } - - @SuppressWarnings("unchecked") - public void run(IAction action) { - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - IWorkbenchPage page = window.getActivePage(); - IEditorPart activeEditor = page.getActiveEditor(); - if (activeEditor instanceof TaskEditor) { - final TaskEditor taskEditor = (TaskEditor) activeEditor; - IStructuredSelection selection = null; - if (currentSelection instanceof IStructuredSelection) { - selection = (IStructuredSelection) currentSelection; - } - if (selection == null || selection.isEmpty()) { - return; - } - List<ITaskAttachment> attachment = selection.toList(); - if (attachment != null) { - final UpdateAttachmentJob job = new UpdateAttachmentJob(attachment, taskEditor, obsolete); - job.setUser(true); - job.addJobChangeListener(new JobChangeAdapter() { - - @Override - public void done(IJobChangeEvent event) { - if (job.getError() != null) { - IFormPage formPage = taskEditor.getActivePageInstance(); - if (formPage instanceof BugzillaTaskEditorPage) { - final BugzillaTaskEditorPage bugzillaPage = (BugzillaTaskEditorPage) formPage; - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - public void run() { - bugzillaPage.getTaskEditor().setMessage(job.getError().getMessage(), - IMessageProvider.ERROR); - } - }); - } - } - } - }); - job.schedule(); - } - } - } - - @SuppressWarnings("unchecked") - public void selectionChanged(IAction action, ISelection selection) { - this.currentSelection = selection; - IStructuredSelection sructuredSelection = null; - if (selection instanceof IStructuredSelection) { - sructuredSelection = (IStructuredSelection) currentSelection; - } - if (sructuredSelection == null || sructuredSelection.isEmpty()) { - return; - } - List<ITaskAttachment> attachmentList = sructuredSelection.toList(); - action.setEnabled(false); - for (ITaskAttachment taskAttachment : attachmentList) { - TaskAttribute taskAttribute = taskAttachment.getTaskAttribute(); - TaskAttribute deprecated = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_IS_DEPRECATED); - if (deprecated != null && deprecated.getValue().equals("1") != obsolete) { //$NON-NLS-1$ - action.setEnabled(true); - break; - } - } - } -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/Messages.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/Messages.java deleted file mode 100644 index a61722195..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/Messages.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.action; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.bugzilla.ui.action.messages"; //$NON-NLS-1$ - - static { - // load message values from bundle file - reloadMessages(); - } - - public static void reloadMessages() { - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - public static String BugzillaUpdateAttachmentAction_mark_not_obsolete; - - public static String BugzillaUpdateAttachmentAction_mark_obsolete; - - public static String UpdateAttachmentJob_obsolete_not_toggled; - - public static String UpdateAttachmentJob_obsolete_toggled_successfully; - - public static String UpdateAttachmentJob_update_attachments; - - public static String UpdateAttachmentJob_update_attachment; - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/UpdateAttachmentJob.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/UpdateAttachmentJob.java deleted file mode 100644 index 0fa6516ca..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/UpdateAttachmentJob.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.action; - -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.IJobChangeEvent; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.core.runtime.jobs.JobChangeAdapter; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler; -import org.eclipse.mylyn.internal.bugzilla.ui.editor.BugzillaTaskEditorPage; -import org.eclipse.mylyn.internal.tasks.ui.editors.EditorUtil; -import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal; -import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector; -import org.eclipse.mylyn.tasks.core.ITask; -import org.eclipse.mylyn.tasks.core.ITaskAttachment; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.ui.TasksUi; -import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage; -import org.eclipse.mylyn.tasks.ui.editors.TaskEditor; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.forms.editor.IFormPage; -import org.eclipse.ui.forms.widgets.Section; - -/** - * @author Frank Becker - */ -@SuppressWarnings("restriction") -public class UpdateAttachmentJob extends Job { - - private final List<ITaskAttachment> attachment; - - private final TaskEditor editor; - - private final boolean obsolete; - - private IStatus error; - - public UpdateAttachmentJob(List<ITaskAttachment> attachment, TaskEditor editor, boolean obsolete) { - super(Messages.UpdateAttachmentJob_update_attachment); - this.attachment = attachment; - this.editor = editor; - this.obsolete = obsolete; - } - - public IStatus getError() { - return error; - } - - @Override - protected IStatus run(IProgressMonitor monitor) { - final ITask task; - task = editor.getTaskEditorInput().getTask(); - - if (!task.getConnectorKind().equals(BugzillaCorePlugin.CONNECTOR_KIND)) { - return Status.OK_STATUS; - } - AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector( - task.getConnectorKind()); - monitor.beginTask(Messages.UpdateAttachmentJob_update_attachments, attachment.size() * 10 + 10); - try { - for (ITaskAttachment taskAttachment : attachment) { - TaskAttribute taskAttribute = taskAttachment.getTaskAttribute(); - TaskAttribute deprecated = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_IS_DEPRECATED); - if (deprecated != null) { - if (deprecated.getValue().equals("1") && !obsolete) { //$NON-NLS-1$ - try { - deprecated.setValue("0"); //$NON-NLS-1$ - ((BugzillaTaskDataHandler) connector.getTaskDataHandler()).postUpdateAttachment( - taskAttachment.getTaskRepository(), taskAttribute, "update", monitor); //$NON-NLS-1$ - } catch (CoreException e) { - error = e.getStatus(); - deprecated.setValue("1"); //$NON-NLS-1$ - return Status.OK_STATUS; - } - } else if (deprecated.getValue().equals("0") && obsolete) { //$NON-NLS-1$ - try { - deprecated.setValue("1"); //$NON-NLS-1$ - ((BugzillaTaskDataHandler) connector.getTaskDataHandler()).postUpdateAttachment( - taskAttachment.getTaskRepository(), taskAttribute, "update", monitor); //$NON-NLS-1$ - } catch (CoreException e) { - error = e.getStatus(); - deprecated.setValue("0"); //$NON-NLS-1$ - return Status.OK_STATUS; - } - } - } - monitor.worked(10); - } - - if (task != null) { - if (connector != null) { - TasksUiInternal.synchronizeTask(connector, task, true, new JobChangeAdapter() { - @Override - public void done(IJobChangeEvent event) { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - public void run() { - try { - if (editor != null) { - editor.refreshPages(); - editor.getEditorSite().getPage().activate(editor); - IFormPage formPage = editor.getActivePageInstance(); - if (formPage instanceof BugzillaTaskEditorPage) { - BugzillaTaskEditorPage bugzillaPage = (BugzillaTaskEditorPage) formPage; - Control control = bugzillaPage.getPart( - AbstractTaskEditorPage.ID_PART_ATTACHMENTS).getControl(); - if (control instanceof Section) { - Section section = (Section) control; - EditorUtil.toggleExpandableComposite(true, section); - } - } - - } - } finally { - if (editor != null) { - editor.showBusy(false); - } - } - } - }); - } - }); - } - monitor.worked(10); - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - public void run() { - if (editor != null) { - editor.showBusy(true); - } - } - }); - } - } catch (OperationCanceledException e) { - return Status.CANCEL_STATUS; - } finally { - monitor.done(); - } - return Status.OK_STATUS; - } -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/messages.properties b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/messages.properties deleted file mode 100644 index 80f5eed5f..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/messages.properties +++ /dev/null @@ -1,6 +0,0 @@ -BugzillaUpdateAttachmentAction_mark_not_obsolete=Mark not obsolete -BugzillaUpdateAttachmentAction_mark_obsolete=Mark obsolete -UpdateAttachmentJob_obsolete_not_toggled=Obsolete not toggled successful -UpdateAttachmentJob_obsolete_toggled_successfully=Obsolete toggeled successfully -UpdateAttachmentJob_update_attachment=Update attachment -UpdateAttachmentJob_update_attachments=Update attachments diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaCcAttributeEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaCcAttributeEditor.java deleted file mode 100644 index 303cdf34a..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaCcAttributeEditor.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.editor; - -import org.eclipse.jface.layout.GridDataFactory; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.core.data.TaskDataModel; -import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor; -import org.eclipse.mylyn.tasks.ui.editors.LayoutHint; -import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.ColumnSpan; -import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.RowSpan; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.List; -import org.eclipse.ui.forms.widgets.FormToolkit; - -/** - * @author Rob Elves - */ -public class BugzillaCcAttributeEditor extends AbstractAttributeEditor { - - private List list; - - private TaskAttribute attrRemoveCc; - - public BugzillaCcAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) { - super(manager, taskAttribute); - setLayoutHint(new LayoutHint(RowSpan.MULTIPLE, ColumnSpan.SINGLE)); - } - - @Override - public void createControl(Composite parent, FormToolkit toolkit) { - list = new List(parent, SWT.FLAT | SWT.MULTI | SWT.V_SCROLL); - toolkit.adapt(list, true, true); - list.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); - list.setFont(JFaceResources.getDefaultFont()); - GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(list); - - TaskAttribute attrUserCC = getTaskAttribute(); - if (attrUserCC != null) { - for (String value : attrUserCC.getValues()) { - list.add(value); - } - } - - attrRemoveCc = getModel().getTaskData().getRoot().getMappedAttribute(BugzillaAttribute.REMOVECC.getKey()); - - if (attrRemoveCc == null) { - attrRemoveCc = BugzillaTaskDataHandler.createAttribute(getModel().getTaskData(), BugzillaAttribute.REMOVECC); - } - - for (String item : attrRemoveCc.getValues()) { - int i = list.indexOf(item); - if (i != -1) { - list.select(i); - } - } - - list.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - for (String cc : list.getItems()) { - int index = list.indexOf(cc); - if (list.isSelected(index)) { - java.util.List<String> remove = attrRemoveCc.getValues(); - if (!remove.contains(cc)) { - attrRemoveCc.addValue(cc); - } - } else { - attrRemoveCc.removeValue(cc); - } - } - getModel().attributeChanged(attrRemoveCc); - } - }); - - list.showSelection(); - - setControl(list); - } -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaKeywordAttributeEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaKeywordAttributeEditor.java deleted file mode 100644 index d3a1b5ea9..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaKeywordAttributeEditor.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.editor; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.window.Window; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.core.data.TaskDataModel; -import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor; -import org.eclipse.mylyn.tasks.ui.editors.LayoutHint; -import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.ColumnSpan; -import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.RowSpan; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.forms.widgets.FormToolkit; - -/** - * @author Rob Elves - */ -public class BugzillaKeywordAttributeEditor extends AbstractAttributeEditor { - - private Text keywordsText; - - public BugzillaKeywordAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) { - super(manager, taskAttribute); - setLayoutHint(new LayoutHint(RowSpan.SINGLE, ColumnSpan.MULTIPLE)); - } - - @Override - public void createControl(Composite parent, FormToolkit toolkit) { - Composite keywordComposite = toolkit.createComposite(parent); - GridLayout layout = new GridLayout(2, false); - layout.marginWidth = 1; - keywordComposite.setLayout(layout); - - keywordsText = toolkit.createText(keywordComposite, getTaskAttribute().getValue()); - GridData keywordsData = new GridData(GridData.FILL_HORIZONTAL); - keywordsText.setLayoutData(keywordsData); - keywordsText.setEditable(false); - - Button changeKeywordsButton = toolkit.createButton(keywordComposite, Messages.BugzillaKeywordAttributeEditor_Edit_, SWT.FLAT); - GridData keyWordsButtonData = new GridData(); - changeKeywordsButton.setLayoutData(keyWordsButtonData); - changeKeywordsButton.addSelectionListener(new SelectionListener() { - - public void widgetDefaultSelected(SelectionEvent e) { - } - - public void widgetSelected(SelectionEvent e) { - - String keywords = getTaskAttribute().getValue(); - - Shell shell = null; - if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) { - shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - } else { - shell = new Shell(PlatformUI.getWorkbench().getDisplay()); - } - - List<String> validKeywords = new ArrayList<String>(); - try { - validKeywords = BugzillaCorePlugin.getRepositoryConfiguration(getModel().getTaskRepository(), - false, new NullProgressMonitor()).getKeywords(); - } catch (Exception ex) { - // ignore - } - - KeywordsDialog keywordsDialog = new KeywordsDialog(shell, keywords, validKeywords); - int responseCode = keywordsDialog.open(); - - String newKeywords = keywordsDialog.getSelectedKeywordsString(); - if (responseCode == Window.OK && keywords != null) { - keywordsText.setText(newKeywords); - getAttributeMapper().setValue(getTaskAttribute(), newKeywords); - attributeChanged(); - } else { - return; - } - - } - - }); - setControl(keywordComposite); - } - - @Override - protected void decorateIncoming(Color color) { - if (keywordsText != null && !keywordsText.isDisposed()) { - keywordsText.setBackground(color); - } - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaPeoplePart.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaPeoplePart.java deleted file mode 100644 index dab471107..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaPeoplePart.java +++ /dev/null @@ -1,209 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.editor; - -import org.eclipse.jface.layout.GridDataFactory; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor; -import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.forms.widgets.FormToolkit; -import org.eclipse.ui.forms.widgets.Section; - -/** - * @author Rob Elves - */ -public class BugzillaPeoplePart extends AbstractTaskEditorPart { - - private static final int COLUMN_MARGIN = 5; - - public BugzillaPeoplePart() { - setPartName(Messages.BugzillaPeoplePart_People); - } - - private void addAttribute(Composite composite, FormToolkit toolkit, TaskAttribute attribute) { - AbstractAttributeEditor editor = createAttributeEditor(attribute); - if (editor != null) { - editor.createLabelControl(composite, toolkit); - GridDataFactory.defaultsFor(editor.getLabelControl()).indent(COLUMN_MARGIN, 0).applyTo( - editor.getLabelControl()); - editor.createControl(composite, toolkit); - getTaskEditorPage().getAttributeEditorToolkit().adapt(editor); - if (attribute.getId().equals(BugzillaAttribute.CC.getKey())) { - GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).hint(130, 95).applyTo( - editor.getControl()); - } else { - GridDataFactory.fillDefaults() - .grab(true, false) - .align(SWT.FILL, SWT.TOP) - .hint(130, SWT.DEFAULT) - .applyTo(editor.getControl()); - } - } - } - - @Override - public void createControl(Composite parent, FormToolkit toolkit) { - Section section = createSection(parent, toolkit, true); - Composite peopleComposite = toolkit.createComposite(section); - GridLayout layout = new GridLayout(2, false); - layout.marginWidth = 5; - peopleComposite.setLayout(layout); - - addAttribute(peopleComposite, toolkit, getTaskData().getRoot().getMappedAttribute(TaskAttribute.USER_ASSIGNED)); - TaskAttribute assignee = getTaskData().getRoot().getAttribute(BugzillaAttribute.SET_DEFAULT_ASSIGNEE.getKey()); - if (assignee != null) { - addAttribute(peopleComposite, toolkit, assignee); - } - addAttribute(peopleComposite, toolkit, getTaskData().getRoot().getMappedAttribute(TaskAttribute.USER_REPORTER)); - addAttribute(peopleComposite, toolkit, getTaskData().getRoot().getMappedAttribute( - BugzillaAttribute.QA_CONTACT.getKey())); - addAttribute(peopleComposite, toolkit, getTaskData().getRoot().getMappedAttribute( - BugzillaAttribute.NEWCC.getKey())); - addSelfToCC(peopleComposite); - TaskAttribute cc = getTaskData().getRoot().getMappedAttribute(BugzillaAttribute.CC.getKey()); - if (cc != null) { - addAttribute(peopleComposite, toolkit, cc); - toolkit.createLabel(peopleComposite, ""); //$NON-NLS-1$ - Label label = toolkit.createLabel(peopleComposite, Messages.BugzillaPeoplePart__Select_to_remove_); - GridDataFactory.fillDefaults().indent(0, 5).align(SWT.CENTER, SWT.CENTER).applyTo(label); - } - - toolkit.paintBordersFor(peopleComposite); - section.setClient(peopleComposite); - setSection(toolkit, section); - } - - /** - * Creates a check box for adding the repository user to the cc list. Does nothing if the repository does not have a - * valid username, the repository user is the assignee, reporter or already on the the cc list. - */ - protected void addSelfToCC(Composite composite) { - - TaskRepository repository = this.getTaskEditorPage().getTaskRepository(); - - if (repository.getUserName() == null) { - return; - } - - TaskAttribute root = getTaskData().getRoot(); - TaskAttribute owner = root.getMappedAttribute(TaskAttribute.USER_ASSIGNED); - if (owner != null && owner.getValue().indexOf(repository.getUserName()) != -1) { - return; - } - - TaskAttribute reporter = root.getMappedAttribute(TaskAttribute.USER_REPORTER); - if (reporter != null && reporter.getValue().indexOf(repository.getUserName()) != -1) { - return; - } - - TaskAttribute ccAttribute = root.getMappedAttribute(TaskAttribute.USER_CC); - if (ccAttribute != null && ccAttribute.getValues().contains(repository.getUserName())) { - return; - } - - FormToolkit toolkit = getManagedForm().getToolkit(); - TaskAttribute attrAddToCC = getTaskData().getRoot().getMappedAttribute(TaskAttribute.ADD_SELF_CC); - if (attrAddToCC == null) { - attrAddToCC = BugzillaTaskDataHandler.createAttribute(getTaskData(), BugzillaAttribute.ADDSELFCC); - } - addAttribute(composite, toolkit, attrAddToCC); - } - -// protected void addCCList(Composite attributesComposite) { -// -// RepositoryTaskAttribute addCCattribute = taskData.getAttribute(RepositoryTaskAttribute.NEW_CC); -// if (addCCattribute == null) { -// // TODO: remove once TRAC is priming taskData with NEW_CC attribute -// taskData.setAttributeValue(RepositoryTaskAttribute.NEW_CC, ""); -// addCCattribute = taskData.getAttribute(RepositoryTaskAttribute.NEW_CC); -// } -// if (addCCattribute != null) { -// Label label = createLabel(attributesComposite, addCCattribute); -// GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); -// Text text = createTextField(attributesComposite, addCCattribute, SWT.FLAT); -// GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).applyTo(text); -// -// if (hasContentAssist(addCCattribute)) { -// ContentAssistCommandAdapter adapter = applyContentAssist(text, -// createContentProposalProvider(addCCattribute)); -// ILabelProvider propsalLabelProvider = createProposalLabelProvider(addCCattribute); -// if (propsalLabelProvider != null) { -// adapter.setLabelProvider(propsalLabelProvider); -// } -// adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); -// } -// } -// -// TaskAttribute CCattribute = getTaskData().getAttribute(TaskAttribute.USER_CC); -// if (CCattribute != null) { -// Label label = createLabel(attributesComposite, CCattribute); -// GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.TOP).applyTo(label); -// ccList = new org.eclipse.swt.widgets.List(attributesComposite, SWT.MULTI | SWT.V_SCROLL);// SWT.BORDER -// ccList.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); -// ccList.setFont(TEXT_FONT); -// GridData ccListData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); -// ccListData.horizontalSpan = 1; -// ccListData.widthHint = 150; -// ccListData.heightHint = 95; -// ccList.setLayoutData(ccListData); -// if (hasChanged(taskData.getAttribute(RepositoryTaskAttribute.USER_CC))) { -// ccList.setBackground(colorIncoming); -// } -// java.util.List<String> ccs = taskData.getCc(); -// if (ccs != null) { -// for (String cc : ccs) { -// ccList.add(cc); -// } -// } -// java.util.List<String> removedCCs = taskData.getAttributeValues(RepositoryTaskAttribute.REMOVE_CC); -// if (removedCCs != null) { -// for (String item : removedCCs) { -// int i = ccList.indexOf(item); -// if (i != -1) { -// ccList.select(i); -// } -// } -// } -// ccList.addSelectionListener(new SelectionListener() { -// -// public void widgetSelected(SelectionEvent e) { -// for (String cc : ccList.getItems()) { -// int index = ccList.indexOf(cc); -// if (ccList.isSelected(index)) { -// List<String> remove = taskData.getAttributeValues(RepositoryTaskAttribute.REMOVE_CC); -// if (!remove.contains(cc)) { -// taskData.addAttributeValue(RepositoryTaskAttribute.REMOVE_CC, cc); -// } -// } else { -// taskData.removeAttributeValue(RepositoryTaskAttribute.REMOVE_CC, cc); -// } -// } -// attributeChanged(taskData.getAttribute(RepositoryTaskAttribute.REMOVE_CC)); -// } -// -// public void widgetDefaultSelected(SelectionEvent e) { -// } -// }); -// toolkit.createLabel(attributesComposite, ""); -// label = toolkit.createLabel(attributesComposite, "(Select to remove)"); -// GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(label); -// } - -// } -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaPlanningEditorPart.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaPlanningEditorPart.java deleted file mode 100644 index 5dde706bf..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaPlanningEditorPart.java +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.editor; - -import java.util.EnumSet; -import java.util.Locale; -import java.util.Map; -import java.util.Set; - -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor; -import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.forms.IFormColors; -import org.eclipse.ui.forms.widgets.FormToolkit; -import org.eclipse.ui.forms.widgets.Section; - -/** - * @author Rob Elves - */ -public class BugzillaPlanningEditorPart extends AbstractTaskEditorPart { - - private boolean hasIncoming; - - private static final Set<BugzillaAttribute> PLANNING_ATTRIBUTES = EnumSet.of(BugzillaAttribute.ACTUAL_TIME, - BugzillaAttribute.ESTIMATED_TIME, BugzillaAttribute.WORK_TIME, BugzillaAttribute.REMAINING_TIME, - BugzillaAttribute.DEADLINE); - - public BugzillaPlanningEditorPart() { - setPartName(Messages.BugzillaPlanningEditorPart_Team_Planning); - } - - @Override - public void createControl(Composite parent, FormToolkit toolkit) { - initialize(); - Section timeSection = createSection(parent, toolkit, hasIncoming); - - GridLayout gl = new GridLayout(); - GridData gd = new GridData(SWT.FILL, SWT.NONE, false, false); - gd.horizontalSpan = 4; - timeSection.setLayout(gl); - timeSection.setLayoutData(gd); - - Composite timeComposite = toolkit.createComposite(timeSection); - gl = new GridLayout(6, false); - timeComposite.setLayout(gl); - gd = new GridData(); - gd.horizontalSpan = 4; - timeComposite.setLayoutData(gd); - - TaskAttribute attribute = getTaskData().getRoot().getMappedAttribute(BugzillaAttribute.DEADLINE.getKey()); - if (attribute != null) { - AbstractAttributeEditor attributeEditor = createAttributeEditor(attribute); - attributeEditor.createLabelControl(timeComposite, toolkit); - attributeEditor.createControl(timeComposite, toolkit); - getTaskEditorPage().getAttributeEditorToolkit().adapt(attributeEditor); - } - - attribute = getTaskData().getRoot().getMappedAttribute(BugzillaAttribute.ESTIMATED_TIME.getKey()); - AbstractAttributeEditor attributeEditor = createAttributeEditor(attribute); - attributeEditor.createLabelControl(timeComposite, toolkit); - attributeEditor.createControl(timeComposite, toolkit); - getTaskEditorPage().getAttributeEditorToolkit().adapt(attributeEditor); - - Label label = toolkit.createLabel(timeComposite, Messages.BugzillaPlanningEditorPart_Current_Estimate); - label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); - float total = 0; - try { - TaskAttribute attrActualTime = getTaskData().getRoot().getMappedAttribute( - BugzillaAttribute.ACTUAL_TIME.getKey()); - float actual = 0; - if (attrActualTime != null) { - actual = Float.parseFloat(attrActualTime.getValue()); - } - TaskAttribute attrRemainingTime = getTaskData().getRoot().getMappedAttribute( - BugzillaAttribute.REMAINING_TIME.getKey()); - float remaining = 0; - if (attrRemainingTime != null) { - remaining = Float.parseFloat(attrRemainingTime.getValue()); - } - total = actual + remaining; - } catch (Exception e) { - // ignore NumberFormatException - } - - Text currentEstimate = toolkit.createText(timeComposite, "" + total, SWT.FLAT | SWT.READ_ONLY); //$NON-NLS-1$ - currentEstimate.setFont(TEXT_FONT); - toolkit.adapt(currentEstimate, false, false); - currentEstimate.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE); - currentEstimate.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - - attribute = getTaskData().getRoot().getMappedAttribute(BugzillaAttribute.ACTUAL_TIME.getKey()); - if (attribute != null) { - attributeEditor = createAttributeEditor(attribute); - attributeEditor.createLabelControl(timeComposite, toolkit); - attributeEditor.createControl(timeComposite, toolkit); - getTaskEditorPage().getAttributeEditorToolkit().adapt(attributeEditor); - } - - // Add Time - TaskAttribute addTimeAttribute = getTaskData().getRoot().getMappedAttribute( - BugzillaAttribute.WORK_TIME.getKey()); - if (addTimeAttribute == null) { - addTimeAttribute = BugzillaTaskDataHandler.createAttribute(getTaskData(), BugzillaAttribute.WORK_TIME); - - } - if (addTimeAttribute != null) { - addTimeAttribute.setValue("0"); //$NON-NLS-1$ - attributeEditor = createAttributeEditor(addTimeAttribute); - attributeEditor.createLabelControl(timeComposite, toolkit); - attributeEditor.createControl(timeComposite, toolkit); - getTaskEditorPage().getAttributeEditorToolkit().adapt(attributeEditor); - } - - attribute = getTaskData().getRoot().getAttribute(BugzillaAttribute.REMAINING_TIME.getKey()); - if (attribute != null) { - attributeEditor = createAttributeEditor(attribute); - attributeEditor.createLabelControl(timeComposite, toolkit); - attributeEditor.createControl(timeComposite, toolkit); - getTaskEditorPage().getAttributeEditorToolkit().adapt(attributeEditor); - } - - timeSection.setClient(timeComposite); - toolkit.paintBordersFor(timeComposite); - setSection(toolkit, timeSection); - - } - - private void initialize() { - hasIncoming = false; - Map<String, TaskAttribute> attributes = getTaskData().getRoot().getAttributes(); - for (TaskAttribute attribute : attributes.values()) { - - BugzillaAttribute bugzillaAttribute = BugzillaAttribute.UNKNOWN; - try { - bugzillaAttribute = BugzillaAttribute.valueOf(attribute.getId().trim().toUpperCase(Locale.ENGLISH)); - } catch (RuntimeException e) { - if (e instanceof IllegalArgumentException) { - // ignore unrecognized tags - continue; - } - throw e; - } - - if (PLANNING_ATTRIBUTES.contains(bugzillaAttribute)) { - if (getModel().hasIncomingChanges(attribute)) { - hasIncoming = true; - } - } - } - } -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java deleted file mode 100644 index 56a855f55..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java +++ /dev/null @@ -1,360 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.editor; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.dialogs.IMessageProvider; -import org.eclipse.mylyn.commons.core.StatusHandler; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCustomField; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler; -import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; -import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration; -import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin; -import org.eclipse.mylyn.tasks.core.RepositoryStatus; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.core.data.TaskAttributeMetaData; -import org.eclipse.mylyn.tasks.core.data.TaskData; -import org.eclipse.mylyn.tasks.core.data.TaskDataModel; -import org.eclipse.mylyn.tasks.core.data.TaskDataModelEvent; -import org.eclipse.mylyn.tasks.core.data.TaskDataModelListener; -import org.eclipse.mylyn.tasks.ui.TasksUi; -import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor; -import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage; -import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart; -import org.eclipse.mylyn.tasks.ui.editors.AttributeEditorFactory; -import org.eclipse.mylyn.tasks.ui.editors.LayoutHint; -import org.eclipse.mylyn.tasks.ui.editors.TaskEditor; -import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput; -import org.eclipse.mylyn.tasks.ui.editors.TaskEditorPartDescriptor; - -/** - * @author Rob Elves - * @since 3.0 - */ -public class BugzillaTaskEditorPage extends AbstractTaskEditorPage { - - public static final String ID_PART_BUGZILLA_PLANNING = "org.eclipse.mylyn.bugzilla.ui.editors.part.planning"; //$NON-NLS-1$ - - public static final String ID_PART_BUGZILLA_FLAGS = "org.eclipse.mylyn.bugzilla.ui.editors.part.flags"; //$NON-NLS-1$ - - private final Map<TaskAttribute, AbstractAttributeEditor> attributeEditorMap; - - private TaskDataModelListener productListener; - - public BugzillaTaskEditorPage(TaskEditor editor) { - this(editor, BugzillaCorePlugin.CONNECTOR_KIND); - } - - /** - * Call this constructor if extending the Bugzilla connector - * - * @param editor - * @param connectorKind - */ - public BugzillaTaskEditorPage(TaskEditor editor, String connectorKind) { - super(editor, connectorKind); - this.attributeEditorMap = new HashMap<TaskAttribute, AbstractAttributeEditor>(); - } - - @Override - protected Set<TaskEditorPartDescriptor> createPartDescriptors() { - Set<TaskEditorPartDescriptor> descriptors = super.createPartDescriptors(); - - // remove unnecessary default editor parts - for (TaskEditorPartDescriptor taskEditorPartDescriptor : descriptors) { - if (taskEditorPartDescriptor.getId().equals(ID_PART_PEOPLE)) { - descriptors.remove(taskEditorPartDescriptor); - break; - } - } - - // Add Bugzilla Planning part - try { - TaskData data = TasksUi.getTaskDataManager().getTaskData(getTask()); - if (data != null) { - TaskAttribute attrEstimatedTime = data.getRoot().getMappedAttribute( - BugzillaAttribute.ESTIMATED_TIME.getKey()); - if (attrEstimatedTime != null) { - descriptors.add(new TaskEditorPartDescriptor(ID_PART_BUGZILLA_PLANNING) { - @Override - public AbstractTaskEditorPart createPart() { - return new BugzillaPlanningEditorPart(); - } - }.setPath(PATH_ATTRIBUTES)); - } - } - } catch (CoreException e) { - // ignore - } - - // Add the updated Bugzilla people part - descriptors.add(new TaskEditorPartDescriptor(ID_PART_PEOPLE) { - @Override - public AbstractTaskEditorPart createPart() { - return new BugzillaPeoplePart(); - } - }.setPath(PATH_PEOPLE)); - - return descriptors; - } - - @Override - protected AttributeEditorFactory createAttributeEditorFactory() { - AttributeEditorFactory factory = new AttributeEditorFactory(getModel(), getTaskRepository(), getEditorSite()) { - @Override - public AbstractAttributeEditor createEditor(String type, final TaskAttribute taskAttribute) { - AbstractAttributeEditor editor; - if (IBugzillaConstants.EDITOR_TYPE_KEYWORDS.equals(type)) { - editor = new BugzillaKeywordAttributeEditor(getModel(), taskAttribute); - } else if (IBugzillaConstants.EDITOR_TYPE_REMOVECC.equals(type)) { - editor = new BugzillaCcAttributeEditor(getModel(), taskAttribute); - } else if (IBugzillaConstants.EDITOR_TYPE_VOTES.equals(type)) { - editor = new BugzillaVotesEditor(getModel(), taskAttribute); - } else if (IBugzillaConstants.EDITOR_TYPE_FLAG.equals(type)) { - editor = new FlagAttributeEditor(getModel(), taskAttribute); - } else { - editor = super.createEditor(type, taskAttribute); - if (TaskAttribute.TYPE_BOOLEAN.equals(type)) { - editor.setDecorationEnabled(false); - } - } - - if (editor != null && taskAttribute.getId().startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) { - editor.setLayoutHint(new LayoutHint(editor.getLayoutHint()) { - - @Override - public int getPriority() { - return super.getPriority() * 10; - } - }); - } - - TaskAttributeMetaData properties = taskAttribute.getMetaData(); - if (editor != null && IBugzillaConstants.EDITOR_TYPE_FLAG.equals(properties.getType())) { - editor.setLayoutHint(new LayoutHint(editor.getLayoutHint()) { - - @Override - public int getPriority() { - return super.getPriority() * 5; - } - }); - } - BugzillaTaskEditorPage.this.addToAttributeEditorMap(taskAttribute, editor); - return editor; - } - }; - return factory; - } - - @Override - public void doSubmit() { - TaskAttribute summaryAttribute = getModel().getTaskData().getRoot().getMappedAttribute(TaskAttribute.SUMMARY); - if (summaryAttribute != null && summaryAttribute.getValue().length() == 0) { - getTaskEditor().setMessage(Messages.BugzillaTaskEditorPage_Please_enter_a_short_summary_before_submitting, - IMessageProvider.ERROR); - AbstractTaskEditorPart part = getPart(ID_PART_SUMMARY); - if (part != null) { - part.setFocus(); - } - return; - } - - TaskAttribute componentAttribute = getModel().getTaskData().getRoot().getMappedAttribute( - BugzillaAttribute.COMPONENT.getKey()); - if (componentAttribute != null && componentAttribute.getValue().length() == 0) { - getTaskEditor().setMessage(Messages.BugzillaTaskEditorPage_Please_select_a_component_before_submitting, - IMessageProvider.ERROR); - AbstractTaskEditorPart part = getPart(ID_PART_ATTRIBUTES); - if (part != null) { - part.setFocus(); - } - return; - } - - TaskAttribute descriptionAttribute = getModel().getTaskData().getRoot().getMappedAttribute( - TaskAttribute.DESCRIPTION); - if (descriptionAttribute != null && descriptionAttribute.getValue().length() == 0 - && getModel().getTaskData().isNew()) { - getTaskEditor().setMessage(Messages.BugzillaTaskEditorPage_Please_enter_a_description_before_submitting, - IMessageProvider.ERROR); - AbstractTaskEditorPart descriptionPart = getPart(ID_PART_DESCRIPTION); - if (descriptionPart != null) { - descriptionPart.setFocus(); - } - return; - } - - if (getModel().getTaskData().isNew()) { - TaskAttribute productAttribute = getModel().getTaskData().getRoot().getMappedAttribute( - TaskAttribute.PRODUCT); - if (productAttribute != null && productAttribute.getValue().length() > 0) { - getModel().getTaskRepository().setProperty(IBugzillaConstants.LAST_PRODUCT_SELECTION, - productAttribute.getValue()); - } - } - - // Force the most recent known good token onto the outgoing task data to ensure submit - // bug#263318 - TaskAttribute attrToken = getModel().getTaskData().getRoot().getAttribute(BugzillaAttribute.TOKEN.getKey()); - if (attrToken != null) { - attrToken.setValue(getModel().getTask().getAttribute(BugzillaAttribute.TOKEN.getKey())); - } - - super.doSubmit(); - } - - @Override - protected void createParts() { - attributeEditorMap.clear(); - super.createParts(); - } - - @Override - protected TaskDataModel createModel(TaskEditorInput input) throws CoreException { - TaskDataModel model = super.createModel(input); - productListener = new ProductSelectionListener(); - model.addModelListener(productListener); - return model; - } - - /** - * @since 3.1 - */ - private void addToAttributeEditorMap(TaskAttribute attribute, AbstractAttributeEditor editor) { - if (attributeEditorMap.containsKey(attribute)) { - attributeEditorMap.remove(attribute); - } - attributeEditorMap.put(attribute, editor); - } - - /** - * @since 3.1 - */ - private AbstractAttributeEditor getEditorForAttribute(TaskAttribute attribute) { - return attributeEditorMap.get(attribute); - } - - private void refresh(TaskAttribute attributeComponent) { - AbstractAttributeEditor editor = getEditorForAttribute(attributeComponent); - if (editor != null) { - try { - editor.refresh(); - } catch (UnsupportedOperationException e) { - // ignore - } - } - } - - private class ProductSelectionListener extends TaskDataModelListener { - @Override - public void attributeChanged(TaskDataModelEvent event) { - TaskAttribute taskAttribute = event.getTaskAttribute(); - if (taskAttribute != null) { - if (taskAttribute.getId().equals(BugzillaAttribute.PRODUCT.getKey())) { - RepositoryConfiguration repositoryConfiguration = null; - try { - repositoryConfiguration = BugzillaCorePlugin.getRepositoryConfiguration( - getModel().getTaskRepository(), false, new NullProgressMonitor()); - } catch (CoreException e) { - StatusHandler.log(new RepositoryStatus(getTaskRepository(), IStatus.ERROR, - BugzillaUiPlugin.ID_PLUGIN, 0, "Failed to obtain repository configuration", e)); //$NON-NLS-1$ - getTaskEditor().setMessage("Problem occured when updating attributes", IMessageProvider.ERROR); //$NON-NLS-1$ - return; - } - - TaskAttribute attributeComponent = taskAttribute.getTaskData().getRoot().getMappedAttribute( - BugzillaAttribute.COMPONENT.getKey()); - if (attributeComponent != null) { - List<String> optionValues = repositoryConfiguration.getComponents(taskAttribute.getValue()); - Collections.sort(optionValues); - attributeComponent.clearOptions(); - for (String option : optionValues) { - attributeComponent.putOption(option, option); - } - if (optionValues.size() == 1) { - attributeComponent.setValue(optionValues.get(0)); - } else { - attributeComponent.setValue(""); //$NON-NLS-1$ - } - refresh(attributeComponent); - } - - TaskAttribute attributeTargetMilestone = taskAttribute.getTaskData().getRoot().getMappedAttribute( - BugzillaAttribute.TARGET_MILESTONE.getKey()); - if (attributeTargetMilestone != null) { - List<String> optionValues = repositoryConfiguration.getTargetMilestones(taskAttribute.getValue()); - Collections.sort(optionValues); - attributeTargetMilestone.clearOptions(); - for (String option : optionValues) { - attributeTargetMilestone.putOption(option, option); - } - if (optionValues.size() == 1) { - attributeTargetMilestone.setValue(optionValues.get(0)); - } else { - attributeTargetMilestone.setValue("---"); //$NON-NLS-1$ - } - refresh(attributeTargetMilestone); - } - - TaskAttribute attributeVersion = taskAttribute.getTaskData().getRoot().getMappedAttribute( - BugzillaAttribute.VERSION.getKey()); - if (attributeVersion != null) { - List<String> optionValues = repositoryConfiguration.getVersions(taskAttribute.getValue()); - Collections.sort(optionValues); - attributeVersion.clearOptions(); - for (String option : optionValues) { - attributeVersion.putOption(option, option); - } - if (optionValues.size() == 1) { - attributeVersion.setValue(optionValues.get(0)); - } else { - attributeVersion.setValue("unspecified"); //$NON-NLS-1$ - } - refresh(attributeVersion); - } - - TaskAttribute attributeDefaultAssignee = taskAttribute.getTaskData().getRoot().getMappedAttribute( - BugzillaAttribute.SET_DEFAULT_ASSIGNEE.getKey()); - if (attributeDefaultAssignee != null) { - attributeDefaultAssignee.setValue("1"); //$NON-NLS-1$ - refresh(attributeDefaultAssignee); - } - -/* - * add confirm_product_change to avoid verification page on submit - */ - TaskAttribute attributeConfirmeProductChange = taskAttribute.getTaskData() - .getRoot() - .getMappedAttribute(BugzillaAttribute.CONFIRM_PRODUCT_CHANGE.getKey()); - if (attributeConfirmeProductChange == null) { - attributeConfirmeProductChange = BugzillaTaskDataHandler.createAttribute( - taskAttribute.getTaskData().getRoot(), BugzillaAttribute.CONFIRM_PRODUCT_CHANGE); - } - if (attributeConfirmeProductChange != null) { - attributeConfirmeProductChange.setValue("1"); //$NON-NLS-1$ - } - } - } - } - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPageFactory.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPageFactory.java deleted file mode 100644 index 23b977679..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPageFactory.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.editor; - -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; -import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages; -import org.eclipse.mylyn.tasks.ui.ITasksUiConstants; -import org.eclipse.mylyn.tasks.ui.TasksUiImages; -import org.eclipse.mylyn.tasks.ui.TasksUiUtil; -import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPageFactory; -import org.eclipse.mylyn.tasks.ui.editors.TaskEditor; -import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.forms.editor.IFormPage; - -/** - * @author Rob Elves - */ -public class BugzillaTaskEditorPageFactory extends AbstractTaskEditorPageFactory { - - @Override - public boolean canCreatePageFor(TaskEditorInput input) { - if (input.getTask().getConnectorKind().equals(BugzillaCorePlugin.CONNECTOR_KIND) - || TasksUiUtil.isOutgoingNewTask(input.getTask(), BugzillaCorePlugin.CONNECTOR_KIND)) { - return true; - } - return false; - } - - @Override - public IFormPage createPage(TaskEditor parentEditor) { - return new BugzillaTaskEditorPage(parentEditor); - } - - @Override - public String[] getConflictingIds(TaskEditorInput input) { - if (!input.getTask().getConnectorKind().equals(BugzillaCorePlugin.CONNECTOR_KIND)) { - return new String[] { ITasksUiConstants.ID_PAGE_PLANNING }; - } - return null; - } - - @Override - public int getPriority() { - return PRIORITY_TASK; - } - - @Override - public Image getPageImage() { - return CommonImages.getImage(TasksUiImages.REPOSITORY_SMALL); - } - - @Override - public String getPageText() { - return "Bugzilla"; //$NON-NLS-1$ - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaVotesEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaVotesEditor.java deleted file mode 100644 index d2ba620e2..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaVotesEditor.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.editor; - -import org.eclipse.jface.layout.GridDataFactory; -import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.core.data.TaskDataModel; -import org.eclipse.mylyn.tasks.ui.TasksUiUtil; -import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.forms.IFormColors; -import org.eclipse.ui.forms.events.HyperlinkAdapter; -import org.eclipse.ui.forms.events.HyperlinkEvent; -import org.eclipse.ui.forms.widgets.FormToolkit; -import org.eclipse.ui.forms.widgets.Hyperlink; - -/** - * @author Rob Elves - */ -public class BugzillaVotesEditor extends AbstractAttributeEditor { - - // Copy from <code>TaskEditorAttributePart</code> - private static final int LABEL_WIDTH = 100; - - // Copy from TaskEditorAttributePart - private static final int COLUMN_GAP = 5; - - public BugzillaVotesEditor(TaskDataModel manager, TaskAttribute taskAttribute) { - super(manager, taskAttribute); - } - - private Hyperlink voteControl; - - private Label hiddenLabel; - - private Hyperlink showVotes; - - @Override - public void createControl(Composite parent, FormToolkit toolkit) { - ((GridData) getLabelControl().getLayoutData()).exclude = true; - showVotes = toolkit.createHyperlink(parent, getTaskAttribute().getValue(), SWT.NONE); - showVotes.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); - showVotes.setToolTipText(Messages.BugzillaVotesEditor_Show_votes); - showVotes.addHyperlinkListener(new HyperlinkAdapter() { - @Override - public void linkActivated(HyperlinkEvent e) { - TasksUiUtil.openUrl(getTaskAttribute().getTaskData().getRepositoryUrl() - + IBugzillaConstants.URL_SHOW_VOTES + getTaskAttribute().getTaskData().getTaskId()); - } - }); - setControl(showVotes); - } - - @Override - public void createLabelControl(Composite composite, FormToolkit toolkit) { - voteControl = toolkit.createHyperlink(composite, getLabel(), SWT.NONE); - voteControl.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); - voteControl.setToolTipText(Messages.BugzillaVotesEditor_Vote); - voteControl.addHyperlinkListener(new HyperlinkAdapter() { - @Override - public void linkActivated(HyperlinkEvent e) { - TasksUiUtil.openUrl(getTaskAttribute().getTaskData().getRepositoryUrl() + IBugzillaConstants.URL_VOTE - + getTaskAttribute().getTaskData().getTaskId()); - } - }); - - GridData gd = GridDataFactory.fillDefaults() - .align(SWT.RIGHT, SWT.CENTER) - .hint(LABEL_WIDTH, SWT.DEFAULT) - .create(); - - gd.horizontalIndent = COLUMN_GAP; - gd.widthHint = LABEL_WIDTH + COLUMN_GAP; - - voteControl.setLayoutData(gd); - - hiddenLabel = toolkit.createLabel(composite, ""); //$NON-NLS-1$ - GridData data = new GridData(); - data.exclude = true; - hiddenLabel.setLayoutData(data); - } - - @Override - protected void decorateOutgoing(Color color) { - // ignore - } - - @Override - public Label getLabelControl() { - return hiddenLabel; - } - - public String getValue() { - return getAttributeMapper().getValue(getTaskAttribute()); - } - - public void setValue(String text) { - getAttributeMapper().setValue(getTaskAttribute(), text); - attributeChanged(); - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/FlagAttributeEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/FlagAttributeEditor.java deleted file mode 100644 index 47bca654e..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/FlagAttributeEditor.java +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Mylyn project committers 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 - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.editor; - -import java.util.Map; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.core.data.TaskDataModel; -import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor; -import org.eclipse.mylyn.tasks.ui.editors.LayoutHint; -import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.ColumnSpan; -import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.RowSpan; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.events.FocusEvent; -import org.eclipse.swt.events.FocusListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.forms.widgets.FormToolkit; - -/** - * @author Frank Becker - */ -public class FlagAttributeEditor extends AbstractAttributeEditor { - - private String[] values; - - private CCombo combo; - - private Text requesteeText; - - public FlagAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) { - super(manager, taskAttribute); - setLayoutHint(new LayoutHint(RowSpan.SINGLE, ColumnSpan.SINGLE)); - if (taskAttribute.getAttribute("state") != null) { //$NON-NLS-1$ - setReadOnly(taskAttribute.getAttribute("state").getMetaData().isReadOnly()); //$NON-NLS-1$ - } - } - - @Override - public void createControl(Composite parent, FormToolkit toolkit) { - Composite composite = toolkit.createComposite(parent); - GridLayout layout = new GridLayout(3, false); - layout.marginWidth = 1; - composite.setLayout(layout); - if (isReadOnly()) { - Text text = new Text(composite, SWT.FLAT | SWT.READ_ONLY); - toolkit.adapt(text, false, false); - text.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE); - text.setText(getValueLabel()); - String tooltip = getTaskAttribute().getMetaData().getLabel(); - if (tooltip != null) { - text.setToolTipText(tooltip); - } - } else { - combo = new CCombo(composite, SWT.FLAT | SWT.READ_ONLY); - toolkit.adapt(combo, false, false); - combo.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); - String tooltip = getTaskAttribute().getMetaData().getLabel(); - if (tooltip != null) { - combo.setToolTipText(tooltip); - } - - Map<String, String> labelByValue = getAttributeMapper().getAssoctiatedAttribute(getTaskAttribute()) - .getOptions(); - if (labelByValue != null) { - values = labelByValue.keySet().toArray(new String[0]); - for (String value : values) { - combo.add(labelByValue.get(value)); - } - } - - select(getValue(), getValueLabel()); - - if (values != null) { - combo.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - int index = combo.getSelectionIndex(); - if (index > -1) { - Assert.isNotNull(values); - Assert.isLegal(index >= 0 && index <= values.length - 1); - setValue(values[index]); - if (requesteeText != null) { - requesteeText.setEnabled(values[index].equals("?")); //$NON-NLS-1$ - } - } - } - }); - } - TaskAttribute requestee = getTaskAttribute().getAttribute("requestee"); //$NON-NLS-1$ - if (requestee != null && !requestee.getMetaData().isReadOnly()) { - requesteeText = toolkit.createText(composite, requestee.getValue()); - requesteeText.setEnabled("?".equals(getValueLabel())); //$NON-NLS-1$ - GridData requesteeData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - requesteeData.widthHint = 78; - requesteeText.setLayoutData(requesteeData); - requesteeText.addFocusListener(new FocusListener() { - - public void focusGained(FocusEvent e) { - } - - public void focusLost(FocusEvent e) { - setRequestee(requesteeText.getText()); - } - }); - } - } - toolkit.paintBordersFor(composite); - setControl(composite); - } - - public String getValue() { -// return getAttributeMapper().getValue(getTaskAttribute()); - return getAttributeMapper().getValue(getAttributeMapper().getAssoctiatedAttribute(getTaskAttribute())); - } - - public String getValueLabel() { -// return getAttributeMapper().getValueLabel(getTaskAttribute()); - return getAttributeMapper().getValueLabel(getAttributeMapper().getAssoctiatedAttribute(getTaskAttribute())); - } - - private void select(String value, String label) { - if (values != null) { - for (int i = 0; i < values.length; i++) { - if (values[i].equals(value)) { - combo.select(i); - break; - } - } - } else { - combo.setText(label); - } - } - - public void setRequestee(String value) { - TaskAttribute requestee = getTaskAttribute().getAttribute("requestee"); //$NON-NLS-1$ - if (requestee != null) { - getAttributeMapper().setValue(getTaskAttribute().getAttribute("requestee"), value); //$NON-NLS-1$ - attributeChanged(); - } - } - - public void setValue(String value) { - getAttributeMapper().setValue(getAttributeMapper().getAssoctiatedAttribute(getTaskAttribute()), value); - attributeChanged(); - } - - @Override - public String getLabel() { - String label = getAttributeMapper().getLabel(getAttributeMapper().getAssoctiatedAttribute(getTaskAttribute())); - if (label != null) { - label.replace("&", "&&"); //$NON-NLS-1$//$NON-NLS-2$ - } else { - label = ""; //$NON-NLS-1$ - } - - TaskAttribute setter = getTaskAttribute().getAttribute("setter"); //$NON-NLS-1$ - if (setter != null) { - String setterValue = setter.getValue(); - if (setterValue != null && !setterValue.equals("")) { //$NON-NLS-1$ - if (setterValue.indexOf("@") != 0) { //$NON-NLS-1$ - setterValue = setterValue.substring(0, setterValue.indexOf("@")); //$NON-NLS-1$ - } - label = setterValue + ": " + label; //$NON-NLS-1$ - } - } - return label; - } -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/KeywordsDialog.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/KeywordsDialog.java deleted file mode 100644 index 396920aff..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/KeywordsDialog.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.editor; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.StringTokenizer; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; - -/** - * @author Shawn Minto - */ -public class KeywordsDialog extends Dialog { - - private final List<String> selectedKeywords; - - private final List<String> validKeywords; - - private CheckboxTableViewer keyWordsList; - - public KeywordsDialog(Shell shell, String selectedKeywords, java.util.List<String> validKeywords) { - super(shell); - setShellStyle(getShellStyle() | SWT.RESIZE); - StringTokenizer st = new StringTokenizer(selectedKeywords, ",", false); //$NON-NLS-1$ - this.selectedKeywords = new ArrayList<String>(); - while (st.hasMoreTokens()) { - String s = st.nextToken().trim(); - this.selectedKeywords.add(s); - } - - this.validKeywords = validKeywords; - } - - @Override - protected Control createDialogArea(Composite parent) { - getShell().setText(Messages.KeywordsDialog_Select_Keywords); - - Composite composite = new Composite(parent, SWT.NONE); - composite.setLayout(new GridLayout()); - GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); - composite.setLayoutData(gd); - - keyWordsList = CheckboxTableViewer.newCheckList(composite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - GridData keyWordsTextData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); - keyWordsTextData.heightHint = 175; - keyWordsTextData.widthHint = 160; - keyWordsList.getTable().setLayoutData(keyWordsTextData); - - if (validKeywords != null) { - - keyWordsList.setContentProvider(new ITreeContentProvider() { - - public Object[] getChildren(Object parentElement) { - if (parentElement instanceof Collection<?>) { - return ((Collection<?>) parentElement).toArray(); - } - return null; - } - - public Object getParent(Object element) { - return null; - } - - public boolean hasChildren(Object element) { - return false; - } - - public Object[] getElements(Object inputElement) { - return getChildren(inputElement); - } - - public void dispose() { - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - - }); - - Set<String> invalidKeywords = new HashSet<String>(); - - keyWordsList.setInput(validKeywords); - - for (String keyword : selectedKeywords) { - if (!keyWordsList.setChecked(keyword, true)) { - invalidKeywords.add(keyword); - } - } - - selectedKeywords.removeAll(invalidKeywords); - - } - - keyWordsList.addCheckStateListener(new KeywordListener()); - - parent.pack(); - - applyDialogFont(composite); - - return composite; - } - - protected class KeywordListener implements ICheckStateListener { - - public void checkStateChanged(CheckStateChangedEvent event) { - if (event.getChecked()) { - selectedKeywords.add((String) event.getElement()); - } else { - selectedKeywords.remove(event.getElement()); - } - } - - } - - public List<String> getSelectedKeywords() { - return selectedKeywords; - } - - public String getSelectedKeywordsString() { - StringBuffer keywords = new StringBuffer(); - - for (String sel : selectedKeywords) { - keywords.append(sel); - keywords.append(","); //$NON-NLS-1$ - } - - String keywordsString = keywords.toString(); - - if (keywordsString.endsWith(",")) { //$NON-NLS-1$ - keywordsString = keywordsString.substring(0, keywordsString.length() - 1); - } - - return keywordsString; - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java deleted file mode 100644 index edbecef51..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.editor; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.bugzilla.ui.editor.messages"; //$NON-NLS-1$ - - static { - // load message values from bundle file - reloadMessages(); - } - - public static void reloadMessages() { - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - public static String BugzillaFlagPart_flags; - - public static String BugzillaKeywordAttributeEditor_Edit_; - - public static String BugzillaPeoplePart_People; - - public static String BugzillaPeoplePart__Select_to_remove_; - - public static String BugzillaPlanningEditorPart_Current_Estimate; - - public static String BugzillaPlanningEditorPart_Team_Planning; - - public static String BugzillaTaskEditorPage_Please_enter_a_description_before_submitting; - - public static String BugzillaTaskEditorPage_Please_enter_a_short_summary_before_submitting; - - public static String BugzillaTaskEditorPage_Please_select_a_component_before_submitting; - - public static String BugzillaVotesEditor_Show_votes; - - public static String BugzillaVotesEditor_Vote; - - public static String KeywordsDialog_Select_Keywords; -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties deleted file mode 100644 index 1644c5bfc..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties +++ /dev/null @@ -1,17 +0,0 @@ -BugzillaFlagPart_flags=Flags -BugzillaKeywordAttributeEditor_Edit_=Edit... - -BugzillaPeoplePart_People=People -BugzillaPeoplePart__Select_to_remove_=(Select to remove) - -BugzillaPlanningEditorPart_Current_Estimate=Current Estimate: -BugzillaPlanningEditorPart_Team_Planning=Team Planning - -BugzillaTaskEditorPage_Please_enter_a_description_before_submitting=Please enter a description before submitting -BugzillaTaskEditorPage_Please_enter_a_short_summary_before_submitting=Please enter a short summary before submitting -BugzillaTaskEditorPage_Please_select_a_component_before_submitting=Please select a component before submitting - -BugzillaVotesEditor_Show_votes=Show votes -BugzillaVotesEditor_Vote=Vote - -KeywordsDialog_Select_Keywords=Select Keywords diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java deleted file mode 100644 index 719aa056c..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java +++ /dev/null @@ -1,1960 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - * Frank Becker - improvements - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.search; - -import java.io.UnsupportedEncodingException; -import java.lang.reflect.InvocationTargetException; -import java.net.URLDecoder; -import java.net.URLEncoder; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Arrays; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.DialogSettings; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.fieldassist.ComboContentAdapter; -import org.eclipse.jface.fieldassist.ContentProposalAdapter; -import org.eclipse.jface.fieldassist.IContentProposalProvider; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.window.Window; -import org.eclipse.mylyn.commons.core.StatusHandler; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; -import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; -import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration; -import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin; -import org.eclipse.mylyn.internal.bugzilla.ui.editor.KeywordsDialog; -import org.eclipse.mylyn.internal.tasks.ui.util.WebBrowserDialog; -import org.eclipse.mylyn.tasks.core.IRepositoryQuery; -import org.eclipse.mylyn.tasks.core.RepositoryStatus; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.ui.TasksUi; -import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter; -import org.eclipse.ui.progress.IProgressService; -import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; - -/** - * Bugzilla search page - * - * @author Mik Kersten (hardening of prototype) - * @author Frank Becker - */ -public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements Listener { - - private static final int HEIGHT_ATTRIBUTE_COMBO = 70; - - // protected Combo repositoryCombo = null; - - private static ArrayList<BugzillaSearchData> previousSummaryPatterns = new ArrayList<BugzillaSearchData>(20); - - private static ArrayList<BugzillaSearchData> previousEmailPatterns = new ArrayList<BugzillaSearchData>(20); - - private static ArrayList<BugzillaSearchData> previousEmailPatterns2 = new ArrayList<BugzillaSearchData>(20); - - private static ArrayList<BugzillaSearchData> previousCommentPatterns = new ArrayList<BugzillaSearchData>(20); - - private static ArrayList<BugzillaSearchData> previousKeywords = new ArrayList<BugzillaSearchData>(20); - - private boolean firstTime = true; - - private IDialogSettings fDialogSettings; - - private static final String[] patternOperationText = { Messages.BugzillaSearchPage_all_words, - Messages.BugzillaSearchPage_any_word, Messages.BugzillaSearchPage_regexp, - Messages.BugzillaSearchPage_notregexp }; - - private static final String[] patternOperationValues = { "allwordssubstr", "anywordssubstr", "regexp", "notregexp" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - - private static final String[] emailOperationText = { Messages.BugzillaSearchPage_substring, - Messages.BugzillaSearchPage_exact, Messages.BugzillaSearchPage_regexp, - Messages.BugzillaSearchPage_notregexp }; - - private static final String[] emailOperationValues = { "substring", "exact", "regexp", "notregexp" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - - private static final String[] keywordOperationText = { Messages.BugzillaSearchPage_all, - Messages.BugzillaSearchPage_any, Messages.BugzillaSearchPage_none }; - - private static final String[] keywordOperationValues = { "allwords", "anywords", "nowords" }; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ - - private static final String[] emailRoleValues = { "emailassigned_to1", "emailreporter1", "emailcc1", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "emaillongdesc1" }; //$NON-NLS-1$ - - private static final String[] emailRoleValues2 = { "emailassigned_to2", "emailreporter2", "emailcc2", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "emaillongdesc2" }; //$NON-NLS-1$ - - // dialog store id constants - private final static String DIALOG_BOUNDS_KEY = "ResizableDialogBounds"; //$NON-NLS-1$ - - private static final String X = "x"; //$NON-NLS-1$ - - private static final String Y = "y"; //$NON-NLS-1$ - - private static final String WIDTH = "width"; //$NON-NLS-1$ - - private static final String HEIGHT = "height"; //$NON-NLS-1$ - - private IRepositoryQuery originalQuery = null; - - protected boolean restoring = false; - - private boolean restoreQueryOptions = true; - - protected Combo summaryPattern; - - protected Combo summaryOperation; - - protected List product; - - protected List os; - - protected List hardware; - - protected List priority; - - protected List severity; - - protected List resolution; - - protected List status; - - protected Combo commentOperation; - - protected Combo commentPattern; - - protected List component; - - protected List version; - - protected List target; - - protected Combo emailOperation; - - protected Combo emailOperation2; - - protected Combo emailPattern; - - protected Combo emailPattern2; - - protected Button[] emailButtons; - - protected Button[] emailButtons2; - - private Combo keywords; - - private Combo keywordsOperation; - - protected Text daysText; - - // /** File containing saved queries */ - // protected static SavedQueryFile input; - - // /** "Remember query" button */ - // protected Button saveButton; - - // /** "Saved queries..." button */ - // protected Button loadButton; - - // /** Run a remembered query */ - // protected boolean rememberedQuery = false; - - /** Index of the saved query to run */ - protected int selIndex; - - // --------------- Configuration handling -------------- - - // Dialog store taskId constants - protected final static String PAGE_NAME = "BugzillaSearchPage"; //$NON-NLS-1$ - - private static final String STORE_PRODUCT_ID = PAGE_NAME + ".PRODUCT"; //$NON-NLS-1$ - - private static final String STORE_COMPONENT_ID = PAGE_NAME + ".COMPONENT"; //$NON-NLS-1$ - - private static final String STORE_VERSION_ID = PAGE_NAME + ".VERSION"; //$NON-NLS-1$ - - private static final String STORE_MSTONE_ID = PAGE_NAME + ".MILESTONE"; //$NON-NLS-1$ - - private static final String STORE_STATUS_ID = PAGE_NAME + ".STATUS"; //$NON-NLS-1$ - - private static final String STORE_RESOLUTION_ID = PAGE_NAME + ".RESOLUTION"; //$NON-NLS-1$ - - private static final String STORE_SEVERITY_ID = PAGE_NAME + ".SEVERITY"; //$NON-NLS-1$ - - private static final String STORE_PRIORITY_ID = PAGE_NAME + ".PRIORITY"; //$NON-NLS-1$ - - private static final String STORE_HARDWARE_ID = PAGE_NAME + ".HARDWARE"; //$NON-NLS-1$ - - private static final String STORE_OS_ID = PAGE_NAME + ".OS"; //$NON-NLS-1$ - - private static final String STORE_SUMMARYMATCH_ID = PAGE_NAME + ".SUMMARYMATCH"; //$NON-NLS-1$ - - private static final String STORE_COMMENTMATCH_ID = PAGE_NAME + ".COMMENTMATCH"; //$NON-NLS-1$ - - private static final String STORE_EMAILMATCH_ID = PAGE_NAME + ".EMAILMATCH"; //$NON-NLS-1$ - - private static final String STORE_EMAIL2MATCH_ID = PAGE_NAME + ".EMAIL2MATCH"; //$NON-NLS-1$ - - private static final String STORE_EMAILBUTTON_ID = PAGE_NAME + ".EMAILATTR"; //$NON-NLS-1$ - - private static final String STORE_EMAIL2BUTTON_ID = PAGE_NAME + ".EMAIL2ATTR"; //$NON-NLS-1$ - - private static final String STORE_SUMMARYTEXT_ID = PAGE_NAME + ".SUMMARYTEXT"; //$NON-NLS-1$ - - private static final String STORE_COMMENTTEXT_ID = PAGE_NAME + ".COMMENTTEXT"; //$NON-NLS-1$ - - private static final String STORE_EMAILADDRESS_ID = PAGE_NAME + ".EMAILADDRESS"; //$NON-NLS-1$ - - private static final String STORE_EMAIL2ADDRESS_ID = PAGE_NAME + ".EMAIL2ADDRESS"; //$NON-NLS-1$ - - private static final String STORE_KEYWORDS_ID = PAGE_NAME + ".KEYWORDS"; //$NON-NLS-1$ - - private static final String STORE_KEYWORDSMATCH_ID = PAGE_NAME + ".KEYWORDSMATCH"; //$NON-NLS-1$ - - // private static final String STORE_REPO_ID = PAGE_NAME + ".REPO"; - - private RepositoryConfiguration repositoryConfiguration; - - private final SelectionAdapter updateActionSelectionAdapter = new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (isControlCreated()) { - setPageComplete(isPageComplete()); - } - } - }; - - private Text queryTitle; - - private final class ModifyListenerImplementation implements ModifyListener { - public void modifyText(ModifyEvent e) { - if (isControlCreated()) { - setPageComplete(isPageComplete()); - } - } - } - - @Override - public void setPageComplete(boolean complete) { - super.setPageComplete(complete); - if (getSearchContainer() != null) { - getSearchContainer().setPerformActionEnabled(complete); - } - } - - private static class BugzillaSearchData { - /** Pattern to match on */ - String pattern; - - /** Pattern matching criterion */ - int operation; - - BugzillaSearchData(String pattern, int operation) { - this.pattern = pattern; - this.operation = operation; - } - } - - public BugzillaSearchPage(TaskRepository repository) { - super(Messages.BugzillaSearchPage_Bugzilla_Query, repository); - // setTitle(TITLE); - // setDescription(DESCRIPTION); - // setImageDescriptor(TaskListImages.BANNER_REPOSITORY); - // setPageComplete(false); -// try { -// repositoryConfiguration = BugzillaCorePlugin.getRepositoryConfiguration(repository, false); -// } catch (final CoreException e) { -// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { -// public void run() { -// MessageDialog.openError(Display.getDefault().getActiveShell(), "Bugzilla Search Page", -// "Unable to get configuration. Ensure proper repository configuration in " -// + TasksUiPlugin.LABEL_VIEW_REPOSITORIES + ".\n\n"); -// } -// }); -// } - } - - public BugzillaSearchPage(TaskRepository repository, IRepositoryQuery origQuery) { - super(Messages.BugzillaSearchPage_Bugzilla_Query, repository, origQuery); - originalQuery = origQuery; - setDescription(Messages.BugzillaSearchPage_Select_the_Bugzilla_query_parameters); - // setTitle(TITLE); - // setDescription(DESCRIPTION); - // setPageComplete(false); -// try { -// repositoryConfiguration = BugzillaCorePlugin.getRepositoryConfiguration(repository, false); -// } catch (final CoreException e) { -// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { -// public void run() { -// MessageDialog.openError(Display.getDefault().getActiveShell(), "Bugzilla Search Page", -// "Unable to get configuration. Ensure proper repository configuration in " -// + TasksUiPlugin.LABEL_VIEW_REPOSITORIES + ".\n\n"); -// } -// }); -// } - } - - public void createControl(Composite parent) { - readConfiguration(); - - Composite control = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(1, false); - layout.marginHeight = 0; - control.setLayout(layout); - control.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL)); - -// if (scontainer == null) { - // Not presenting in search pane so want query title -// super.createControl(control); -// Label lblName = new Label(control, SWT.NONE); -// final GridData gridData = new GridData(); -// lblName.setLayoutData(gridData); -// lblName.setText("Query Title:"); -// -// title = new Text(control, SWT.BORDER); -// title.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); -// title.addModifyListener(new ModifyListener() { -// public void modifyText(ModifyEvent e) { -// setPageComplete(isPageComplete()); -// } -// }); -// } - - // else { - // // if (repository == null) { - // // search pane so add repository selection - // createRepositoryGroup(control); - // } - createOptionsGroup(control); - createSearchGroup(control); - - // createSaveQuery(control); - // createMaxHits(control); - // input = new SavedQueryFile(BugzillaPlugin.getDefault().getStateLocation().toString(), "/queries"); - // createUpdate(control); - // if (originalQuery != null) { - // try { - // updateDefaults(originalQuery.getQueryUrl(), String.valueOf(originalQuery.getMaxHits())); - // } catch (UnsupportedEncodingException e) { - // // ignore - // } - // } - Dialog.applyDialogFont(control); - setControl(control); - PlatformUI.getWorkbench().getHelpSystem().setHelp(control, BugzillaUiPlugin.SEARCH_PAGE_CONTEXT); - restoreBounds(); - } - - protected void createOptionsGroup(Composite control) { - GridLayout sashFormLayout = new GridLayout(); - sashFormLayout.numColumns = 4; - sashFormLayout.marginHeight = 5; - sashFormLayout.marginWidth = 5; - sashFormLayout.horizontalSpacing = 5; - - final Composite composite = new Composite(control, SWT.NONE); - composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); - final GridLayout gridLayout = new GridLayout(); - gridLayout.marginBottom = 8; - gridLayout.marginHeight = 0; - gridLayout.marginWidth = 0; - gridLayout.numColumns = 4; - composite.setLayout(gridLayout); - - if (!inSearchContainer()) { - final Label queryTitleLabel = new Label(composite, SWT.NONE); - queryTitleLabel.setText(Messages.BugzillaSearchPage_Query_Title); - - queryTitle = new Text(composite, SWT.BORDER); - queryTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); - if (originalQuery != null) { - queryTitle.setText(originalQuery.getSummary()); - } - queryTitle.addModifyListener(new ModifyListenerImplementation()); - queryTitle.setFocus(); - } - - // Info text - Label labelSummary = new Label(composite, SWT.LEFT); - labelSummary.setText(Messages.BugzillaSearchPage_Summary); -// labelSummary.setLayoutData(new GridData(LABEL_WIDTH, SWT.DEFAULT)); - //labelSummary.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - // Pattern combo - summaryPattern = new Combo(composite, SWT.SINGLE | SWT.BORDER); - summaryPattern.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); - summaryPattern.addModifyListener(new ModifyListenerImplementation()); - summaryPattern.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleWidgetSelected(summaryPattern, summaryOperation, previousSummaryPatterns); - } - }); - - summaryOperation = new Combo(composite, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); - summaryOperation.setItems(patternOperationText); - summaryOperation.setText(patternOperationText[0]); - summaryOperation.select(0); - - // Info text - Label labelComment = new Label(composite, SWT.LEFT); - labelComment.setText(Messages.BugzillaSearchPage_Comment); - //labelComment.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - // Comment pattern combo - commentPattern = new Combo(composite, SWT.SINGLE | SWT.BORDER); - commentPattern.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); - commentPattern.addModifyListener(new ModifyListenerImplementation()); - commentPattern.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleWidgetSelected(commentPattern, commentOperation, previousCommentPatterns); - } - }); - - commentOperation = new Combo(composite, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); - commentOperation.setItems(patternOperationText); - commentOperation.setText(patternOperationText[0]); - commentOperation.select(0); - - Label labelEmail = new Label(composite, SWT.LEFT); - labelEmail.setText(Messages.BugzillaSearchPage_Email); - //labelEmail.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - // pattern combo - emailPattern = new Combo(composite, SWT.SINGLE | SWT.BORDER); - emailPattern.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - emailPattern.addModifyListener(new ModifyListenerImplementation()); - emailPattern.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleWidgetSelected(emailPattern, emailOperation, previousEmailPatterns); - } - }); - IContentProposalProvider proposalProvider = TasksUi.getUiFactory().createPersonContentProposalProvider( - getTaskRepository()); - ILabelProvider proposalLabelProvider = TasksUi.getUiFactory().createPersonContentProposalLabelProvider( - getTaskRepository()); - - ContentAssistCommandAdapter adapter = new ContentAssistCommandAdapter(emailPattern, new ComboContentAdapter(), - proposalProvider, ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[0], true); - adapter.setLabelProvider(proposalLabelProvider); - adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); - - Composite emailComposite = new Composite(composite, SWT.NONE); - emailComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); - GridLayout emailLayout = new GridLayout(); - emailLayout.marginWidth = 0; - emailLayout.marginHeight = 0; - emailLayout.horizontalSpacing = 2; - emailLayout.numColumns = 4; - emailComposite.setLayout(emailLayout); - - Button button0 = new Button(emailComposite, SWT.CHECK); - button0.setText(Messages.BugzillaSearchPage_owner); - - Button button1 = new Button(emailComposite, SWT.CHECK); - button1.setText(Messages.BugzillaSearchPage_reporter); - - Button button2 = new Button(emailComposite, SWT.CHECK); - button2.setText(Messages.BugzillaSearchPage_cc); - - Button button3 = new Button(emailComposite, SWT.CHECK); - button3.setText(Messages.BugzillaSearchPage_commenter); - - emailButtons = new Button[] { button0, button1, button2, button3 }; - - // operation combo - emailOperation = new Combo(composite, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); - emailOperation.setItems(emailOperationText); - emailOperation.setText(emailOperationText[0]); - emailOperation.select(0); - - // Email2 - - Label labelEmail2 = new Label(composite, SWT.LEFT); - labelEmail2.setText(Messages.BugzillaSearchPage_Email_2); - //labelEmail.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - // pattern combo - emailPattern2 = new Combo(composite, SWT.SINGLE | SWT.BORDER); - emailPattern2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - emailPattern2.addModifyListener(new ModifyListenerImplementation()); - emailPattern2.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleWidgetSelected(emailPattern2, emailOperation2, previousEmailPatterns2); - } - }); - ContentAssistCommandAdapter adapter2 = new ContentAssistCommandAdapter(emailPattern2, - new ComboContentAdapter(), proposalProvider, ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, - new char[0], true); - adapter.setLabelProvider(proposalLabelProvider); - adapter2.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); - - Composite emailComposite2 = new Composite(composite, SWT.NONE); - emailComposite2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); - GridLayout emailLayout2 = new GridLayout(); - emailLayout2.marginWidth = 0; - emailLayout2.marginHeight = 0; - emailLayout2.horizontalSpacing = 2; - emailLayout2.numColumns = 4; - emailComposite2.setLayout(emailLayout2); - - Button e2button0 = new Button(emailComposite2, SWT.CHECK); - e2button0.setText(Messages.BugzillaSearchPage_owner); - - Button e2button1 = new Button(emailComposite2, SWT.CHECK); - e2button1.setText(Messages.BugzillaSearchPage_reporter); - - Button e2button2 = new Button(emailComposite2, SWT.CHECK); - e2button2.setText(Messages.BugzillaSearchPage_cc); - - Button e2button3 = new Button(emailComposite2, SWT.CHECK); - e2button3.setText(Messages.BugzillaSearchPage_commenter); - - emailButtons2 = new Button[] { e2button0, e2button1, e2button2, e2button3 }; - - // operation combo - emailOperation2 = new Combo(composite, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); - emailOperation2.setItems(emailOperationText); - emailOperation2.setText(emailOperationText[0]); - emailOperation2.select(0); - - ///// - - Label labelKeywords = new Label(composite, SWT.NONE); - labelKeywords.setText(Messages.BugzillaSearchPage_Keywords); -// labelKeywords.setLayoutData(new GridData(LABEL_WIDTH, SWT.DEFAULT)); - //labelKeywords.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Composite keywordsComposite = new Composite(composite, SWT.NONE); - keywordsComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1)); - GridLayout keywordsLayout = new GridLayout(); - keywordsLayout.marginWidth = 0; - keywordsLayout.marginHeight = 0; - keywordsLayout.numColumns = 3; - keywordsComposite.setLayout(keywordsLayout); - - keywordsOperation = new Combo(keywordsComposite, SWT.READ_ONLY); - keywordsOperation.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); - keywordsOperation.setItems(keywordOperationText); - keywordsOperation.setText(keywordOperationText[0]); - keywordsOperation.select(0); - - keywords = new Combo(keywordsComposite, SWT.NONE); - keywords.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - keywords.addModifyListener(new ModifyListenerImplementation()); - keywords.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleWidgetSelected(keywords, keywordsOperation, previousKeywords); - } - }); - - Button keywordsSelectButton = new Button(keywordsComposite, SWT.NONE); - keywordsSelectButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (repositoryConfiguration != null && getShell() != null) { - KeywordsDialog dialog = new KeywordsDialog(getShell(), keywords.getText(), // - repositoryConfiguration.getKeywords()); - if (dialog.open() == Window.OK) { - keywords.setText(dialog.getSelectedKeywordsString()); - } - } - } - }); - keywordsSelectButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); - keywordsSelectButton.setText(Messages.BugzillaSearchPage_Select_); - SashForm sashForm = new SashForm(control, SWT.VERTICAL); - sashForm.setLayout(sashFormLayout); - final GridData gd_sashForm = new GridData(SWT.FILL, SWT.FILL, true, true); - gd_sashForm.widthHint = 500; - sashForm.setLayoutData(gd_sashForm); - - GridLayout topLayout = new GridLayout(); - topLayout.numColumns = 4; - SashForm topForm = new SashForm(sashForm, SWT.NONE); - GridData topLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1); - topLayoutData.widthHint = 500; - topForm.setLayoutData(topLayoutData); - topForm.setLayout(topLayout); - - GridLayout productLayout = new GridLayout(); - productLayout.marginWidth = 0; - productLayout.marginHeight = 0; - productLayout.horizontalSpacing = 0; - Composite productComposite = new Composite(topForm, SWT.NONE); - productComposite.setLayout(productLayout); - - Label productLabel = new Label(productComposite, SWT.LEFT); - productLabel.setText(Messages.BugzillaSearchPage_Product); - productLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - GridData productLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true); - productLayoutData.heightHint = HEIGHT_ATTRIBUTE_COMBO; - product = new List(productComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - product.setLayoutData(productLayoutData); - product.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (product.getSelectionIndex() != -1) { - String[] selectedProducts = product.getSelection(); - updateAttributesFromConfiguration(selectedProducts); - } else { - updateAttributesFromConfiguration(null); - } - if (restoring) { - restoring = false; - restoreWidgetValues(); - } - setPageComplete(isPageComplete()); - } - }); - - GridLayout componentLayout = new GridLayout(); - componentLayout.marginWidth = 0; - componentLayout.marginHeight = 0; - componentLayout.horizontalSpacing = 0; - Composite componentComposite = new Composite(topForm, SWT.NONE); - componentComposite.setLayout(componentLayout); - - Label componentLabel = new Label(componentComposite, SWT.LEFT); - componentLabel.setText(Messages.BugzillaSearchPage_Component); - componentLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - component = new List(componentComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - GridData componentLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true); - componentLayoutData.heightHint = HEIGHT_ATTRIBUTE_COMBO; - component.setLayoutData(componentLayoutData); - component.addSelectionListener(updateActionSelectionAdapter); - - Composite versionComposite = new Composite(topForm, SWT.NONE); - GridLayout versionLayout = new GridLayout(); - versionLayout.marginWidth = 0; - versionLayout.marginHeight = 0; - versionLayout.horizontalSpacing = 0; - versionComposite.setLayout(versionLayout); - - Label versionLabel = new Label(versionComposite, SWT.LEFT); - versionLabel.setText(Messages.BugzillaSearchPage_Version); - versionLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - version = new List(versionComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - GridData versionLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true); - versionLayoutData.heightHint = HEIGHT_ATTRIBUTE_COMBO; - version.setLayoutData(versionLayoutData); - version.addSelectionListener(updateActionSelectionAdapter); - - Composite milestoneComposite = new Composite(topForm, SWT.NONE); - GridLayout milestoneLayout = new GridLayout(); - milestoneLayout.marginWidth = 0; - milestoneLayout.marginHeight = 0; - milestoneLayout.horizontalSpacing = 0; - milestoneComposite.setLayout(milestoneLayout); - - Label milestoneLabel = new Label(milestoneComposite, SWT.LEFT); - milestoneLabel.setText(Messages.BugzillaSearchPage_Milestone); - milestoneLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - target = new List(milestoneComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - GridData targetLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true); - targetLayoutData.heightHint = HEIGHT_ATTRIBUTE_COMBO; - target.setLayoutData(targetLayoutData); - target.addSelectionListener(updateActionSelectionAdapter); - - SashForm bottomForm = new SashForm(sashForm, SWT.NONE); - GridLayout bottomLayout = new GridLayout(); - bottomLayout.numColumns = 6; - bottomForm.setLayout(bottomLayout); - GridData bottomLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1); - bottomLayoutData.heightHint = 119; - bottomLayoutData.widthHint = 400; - bottomForm.setLayoutData(bottomLayoutData); - - Composite statusComposite = new Composite(bottomForm, SWT.NONE); - GridLayout statusLayout = new GridLayout(); - statusLayout.marginTop = 7; - statusLayout.marginWidth = 0; - statusLayout.horizontalSpacing = 0; - statusLayout.marginHeight = 0; - statusComposite.setLayout(statusLayout); - - Label statusLabel = new Label(statusComposite, SWT.LEFT); - statusLabel.setText(Messages.BugzillaSearchPage_Status); - statusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - status = new List(statusComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - final GridData gd_status = new GridData(SWT.FILL, SWT.FILL, true, true); - gd_status.heightHint = 60; - status.setLayoutData(gd_status); - status.addSelectionListener(updateActionSelectionAdapter); - - Composite resolutionComposite = new Composite(bottomForm, SWT.NONE); - GridLayout resolutionLayout = new GridLayout(); - resolutionLayout.marginTop = 7; - resolutionLayout.marginWidth = 0; - resolutionLayout.marginHeight = 0; - resolutionLayout.horizontalSpacing = 0; - resolutionComposite.setLayout(resolutionLayout); - - Label resolutionLabel = new Label(resolutionComposite, SWT.LEFT); - resolutionLabel.setText(Messages.BugzillaSearchPage_Resolution); - resolutionLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - resolution = new List(resolutionComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - final GridData gd_resolution = new GridData(SWT.FILL, SWT.FILL, true, true); - gd_resolution.heightHint = 60; - resolution.setLayoutData(gd_resolution); - resolution.addSelectionListener(updateActionSelectionAdapter); - - Composite priorityComposite = new Composite(bottomForm, SWT.NONE); - GridLayout priorityLayout = new GridLayout(); - priorityLayout.marginTop = 7; - priorityLayout.marginWidth = 0; - priorityLayout.marginHeight = 0; - priorityLayout.horizontalSpacing = 0; - priorityComposite.setLayout(priorityLayout); - - Label priorityLabel = new Label(priorityComposite, SWT.LEFT); - priorityLabel.setText(Messages.BugzillaSearchPage_PROORITY); - priorityLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - priority = new List(priorityComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - final GridData gd_priority = new GridData(SWT.FILL, SWT.FILL, true, true); - gd_priority.heightHint = 60; - priority.setLayoutData(gd_priority); - priority.addSelectionListener(updateActionSelectionAdapter); - - Composite severityComposite = new Composite(bottomForm, SWT.NONE); - GridLayout severityLayout = new GridLayout(); - severityLayout.marginTop = 7; - severityLayout.marginWidth = 0; - severityLayout.marginHeight = 0; - severityLayout.horizontalSpacing = 0; - severityComposite.setLayout(severityLayout); - - Label severityLabel = new Label(severityComposite, SWT.LEFT); - severityLabel.setText(Messages.BugzillaSearchPage_Severity); - severityLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - severity = new List(severityComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - final GridData gd_severity = new GridData(SWT.FILL, SWT.FILL, true, true); - gd_severity.heightHint = 60; - severity.setLayoutData(gd_severity); - severity.addSelectionListener(updateActionSelectionAdapter); - - Composite hardwareComposite = new Composite(bottomForm, SWT.NONE); - GridLayout hardwareLayout = new GridLayout(); - hardwareLayout.marginTop = 7; - hardwareLayout.marginWidth = 0; - hardwareLayout.marginHeight = 0; - hardwareLayout.horizontalSpacing = 0; - hardwareComposite.setLayout(hardwareLayout); - - Label hardwareLabel = new Label(hardwareComposite, SWT.LEFT); - hardwareLabel.setText(Messages.BugzillaSearchPage_Hardware); - hardwareLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - hardware = new List(hardwareComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - final GridData gd_hardware = new GridData(SWT.FILL, SWT.FILL, true, true); - gd_hardware.heightHint = 60; - hardware.setLayoutData(gd_hardware); - hardware.addSelectionListener(updateActionSelectionAdapter); - - Composite osComposite = new Composite(bottomForm, SWT.NONE); - GridLayout osLayout = new GridLayout(); - osLayout.marginTop = 7; - osLayout.marginWidth = 0; - osLayout.marginHeight = 0; - osLayout.horizontalSpacing = 0; - osComposite.setLayout(osLayout); - - Label osLabel = new Label(osComposite, SWT.LEFT); - osLabel.setText(Messages.BugzillaSearchPage_Operating_System); - osLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - os = new List(osComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - final GridData gd_os = new GridData(SWT.FILL, SWT.FILL, true, true); - gd_os.heightHint = 60; - os.setLayoutData(gd_os); - os.addSelectionListener(updateActionSelectionAdapter); - bottomForm.setWeights(new int[] { 88, 90, 50, 77, 88, 85 }); - } - - private void createSearchGroup(Composite control) { - Composite composite = new Composite(control, SWT.NONE); - composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - GridLayout gridLayout = new GridLayout(); - gridLayout.marginTop = 7; - gridLayout.marginHeight = 0; - gridLayout.marginWidth = 0; - gridLayout.numColumns = 2; - composite.setLayout(gridLayout); - - Label changedInTheLabel = new Label(composite, SWT.LEFT); - changedInTheLabel.setLayoutData(new GridData()); - changedInTheLabel.setText(Messages.BugzillaSearchPage_Changed_in); - - Composite updateComposite = new Composite(composite, SWT.NONE); - updateComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - GridLayout updateLayout = new GridLayout(3, false); - updateLayout.marginWidth = 0; - updateLayout.horizontalSpacing = 0; - updateLayout.marginHeight = 0; - updateComposite.setLayout(updateLayout); - - daysText = new Text(updateComposite, SWT.BORDER); - daysText.setLayoutData(new GridData(40, SWT.DEFAULT)); - daysText.setTextLimit(5); - daysText.addListener(SWT.Modify, this); - - Label label = new Label(updateComposite, SWT.LEFT); - label.setText(Messages.BugzillaSearchPage_days); - - Button updateButton = new Button(updateComposite, SWT.PUSH); - updateButton.setText(Messages.BugzillaSearchPage_Update_Attributes_from_Repository); - updateButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); - updateButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (getTaskRepository() != null) { -// try { - - updateConfiguration(true); - -// } catch (final CoreException e1) { -// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { -// public void run() { -// MessageDialog.openError(Display.getDefault().getActiveShell(), "Bugzilla Search Page", -// "Unable to get configuration. Ensure proper repository configuration in " -// + TasksUiPlugin.LABEL_VIEW_REPOSITORIES + ".\n\n"); -// } -// }); -// } - } else { - MessageDialog.openInformation(Display.getCurrent().getActiveShell(), - IBugzillaConstants.TITLE_MESSAGE_DIALOG, - Messages.BugzillaSearchPage_No_repository_available); - } - } - }); - } - - /** - * Creates the buttons for remembering a query and accessing previously saved queries. - */ - protected Control createSaveQuery(Composite control) { - GridLayout layout; - GridData gd; - - Group group = new Group(control, SWT.NONE); - layout = new GridLayout(3, false); - group.setLayout(layout); - group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - gd = new GridData(GridData.BEGINNING | GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); - gd.horizontalSpan = 2; - group.setLayoutData(gd); - - // loadButton = new Button(group, SWT.PUSH | SWT.LEFT); - // loadButton.setText("Saved Queries..."); - // final BugzillaSearchPage bsp = this; - // loadButton.addSelectionListener(new SelectionAdapter() { - // - // @Override - // public void widgetSelected(SelectionEvent event) { - // GetQueryDialog qd = new GetQueryDialog(getShell(), "Saved Queries", - // input); - // if (qd.open() == InputDialog.OK) { - // selIndex = qd.getSelected(); - // if (selIndex != -1) { - // rememberedQuery = true; - // performAction(); - // bsp.getShell().close(); - // } - // } - // } - // }); - // loadButton.setEnabled(true); - // loadButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); - // - // saveButton = new Button(group, SWT.PUSH | SWT.LEFT); - // saveButton.setText("Remember..."); - // saveButton.addSelectionListener(new SelectionAdapter() { - // - // @Override - // public void widgetSelected(SelectionEvent event) { - // SaveQueryDialog qd = new SaveQueryDialog(getShell(), "Remember Query"); - // if (qd.open() == InputDialog.OK) { - // String qName = qd.getText(); - // if (qName != null && qName.compareTo("") != 0) { - // try { - // input.add(getQueryParameters().toString(), qName, summaryPattern.getText()); - // } catch (UnsupportedEncodingException e) { - // /* - // * Do nothing. Every implementation of the Java - // * platform is required to support the standard - // * charset "UTF-8" - // */ - // } - // } - // } - // } - // }); - // saveButton.setEnabled(true); - // saveButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); - - return group; - } - - // public static SavedQueryFile getInput() { - // return input; - // } - - private void handleWidgetSelected(Combo widget, Combo operation, ArrayList<BugzillaSearchData> history) { - if (widget.getSelectionIndex() < 0) { - return; - } - int index = history.size() - 1 - widget.getSelectionIndex(); - BugzillaSearchData patternData = history.get(index); - if (patternData == null || !widget.getText().equals(patternData.pattern)) { - return; - } - widget.setText(patternData.pattern); - operation.setText(operation.getItem(patternData.operation)); - } - - // TODO: avoid overriding? - @Override - public boolean performSearch() { - if (restoreQueryOptions) { - saveState(); - } - - getPatternData(summaryPattern, summaryOperation, previousSummaryPatterns); - getPatternData(commentPattern, commentOperation, previousCommentPatterns); - getPatternData(emailPattern, emailOperation, previousEmailPatterns); - getPatternData(emailPattern2, emailOperation2, previousEmailPatterns2); - getPatternData(keywords, keywordsOperation, previousKeywords); - - String summaryText = summaryPattern.getText(); - BugzillaUiPlugin.getDefault().getPreferenceStore().setValue(IBugzillaConstants.MOST_RECENT_QUERY, summaryText); - - return super.performSearch(); - } - - @Override - public void setVisible(boolean visible) { - if (visible && summaryPattern != null) { - if (firstTime) { - // Set<TaskRepository> repositories = TasksUiPlugin.getRepositoryManager().getRepositories(BugzillaCorePlugin.REPOSITORY_KIND); - // String[] repositoryUrls = new String[repositories.size()]; - // int i = 0; - // int indexToSelect = 0; - // for (Iterator<TaskRepository> iter = repositories.iterator(); iter.hasNext();) { - // TaskRepository currRepsitory = iter.next(); - // // if (i == 0 && repository == null) { - // // repository = currRepsitory; - // // indexToSelect = 0; - // // } - // if (repository != null && repository.equals(currRepsitory)) { - // indexToSelect = i; - // } - // repositoryUrls[i] = currRepsitory.getUrl(); - // i++; - // } - - // IDialogSettings settings = getDialogSettings(); - // if (repositoryCombo != null) { - // repositoryCombo.setItems(repositoryUrls); - // if (repositoryUrls.length == 0) { - // MessageDialog.openInformation(Display.getCurrent().getActiveShell(), IBugzillaConstants.TITLE_MESSAGE_DIALOG, - // TaskRepositoryManager.MESSAGE_NO_REPOSITORY); - // } else { - // String selectRepo = settings.get(STORE_REPO_ID); - // if (selectRepo != null && repositoryCombo.indexOf(selectRepo) > -1) { - // repositoryCombo.setText(selectRepo); - // repository = TasksUiPlugin.getRepositoryManager().getRepository( - // BugzillaCorePlugin.REPOSITORY_KIND, repositoryCombo.getText()); - // if (repository == null) { - // repository = TasksUiPlugin.getRepositoryManager().getDefaultRepository( BugzillaCorePlugin.REPOSITORY_KIND); - // } - // } else { - // repositoryCombo.select(indexToSelect); - // } - // updateAttributesFromRepository(repositoryCombo.getText(), null, false); - // } - // } - - firstTime = false; - // Set item and text here to prevent page from resizing - for (String searchPattern : getPreviousPatterns(previousSummaryPatterns)) { - summaryPattern.add(searchPattern); - } - // summaryPattern.setItems(getPreviousPatterns(previousSummaryPatterns)); - for (String comment : getPreviousPatterns(previousCommentPatterns)) { - commentPattern.add(comment); - } - // commentPattern.setItems(getPreviousPatterns(previousCommentPatterns)); - for (String email : getPreviousPatterns(previousEmailPatterns)) { - emailPattern.add(email); - } - - for (String email : getPreviousPatterns(previousEmailPatterns2)) { - emailPattern2.add(email); - } - - // emailPattern.setItems(getPreviousPatterns(previousEmailPatterns)); - for (String keyword : getPreviousPatterns(previousKeywords)) { - keywords.add(keyword); - } - - // TODO: update status, resolution, severity etc if possible... - if (getTaskRepository() != null) { - updateAttributesFromConfiguration(null); - if (product.getItemCount() == 0) { - try { - repositoryConfiguration = BugzillaCorePlugin.getRepositoryConfiguration( - getTaskRepository(), true, new NullProgressMonitor()); - updateAttributesFromConfiguration(null); - } catch (final CoreException e1) { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - public void run() { - MessageDialog.openError(Display.getDefault().getActiveShell(), - Messages.BugzillaSearchPage_Bugzilla_Search_Page, MessageFormat.format( - Messages.BugzillaSearchPage_Unable_to_get_configuration_X, - Messages.BugzillaSearchPage_Task_Repositories) - + "\n\n"); //$NON-NLS-1$ - } - }); - } - } - } - if (originalQuery != null) { - try { - updateDefaults(originalQuery.getUrl()); - } catch (UnsupportedEncodingException e) { - // ignore - } - } - } - - /* - * hack: we have to select the correct product, then update the - * attributes so the component/version/milestone lists have the - * proper values, then we can restore all the widget selections. - */ - if (getTaskRepository() != null) { - IDialogSettings settings = getDialogSettings(); - String repoId = "." + getTaskRepository().getRepositoryUrl(); //$NON-NLS-1$ - if (getWizard() == null && restoreQueryOptions && settings.getArray(STORE_PRODUCT_ID + repoId) != null - && product != null) { - product.setSelection(nonNullArray(settings, STORE_PRODUCT_ID + repoId)); - if (product.getSelection().length > 0) { - updateAttributesFromConfiguration(product.getSelection()); - } - restoreWidgetValues(); - } - } - setPageComplete(isPageComplete()); - if (getWizard() == null) { - // TODO: wierd check - summaryPattern.setFocus(); - } - } - super.setVisible(visible); - } - - /** - * Returns <code>true</code> if at least some parameter is given to query on. - */ - private boolean canQuery() { - if (isControlCreated()) { - return product.getSelectionCount() > 0 || component.getSelectionCount() > 0 - || version.getSelectionCount() > 0 || target.getSelectionCount() > 0 - || status.getSelectionCount() > 0 || resolution.getSelectionCount() > 0 - || severity.getSelectionCount() > 0 || priority.getSelectionCount() > 0 - || hardware.getSelectionCount() > 0 || os.getSelectionCount() > 0 - || summaryPattern.getText().length() > 0 || commentPattern.getText().length() > 0 - || emailPattern.getText().length() > 0 || emailPattern2.getText().length() > 0 - || keywords.getText().length() > 0; - } else { - return false; - } - } - - @Override - public boolean isPageComplete() { - if (daysText != null) { - String days = daysText.getText(); - if (days.length() > 0) { - try { - if (Integer.parseInt(days) < 0) { - throw new NumberFormatException(); - } - } catch (NumberFormatException ex) { - setErrorMessage(NLS.bind(Messages.BugzillaSearchPage_Number_of_days_must_be_a_positive_integer, - days)); - return false; - } - } - } - return getWizard() == null ? canQuery() : canQuery() && super.isPageComplete(); - } - - /** - * Return search pattern data and update search history list. An existing entry will be updated or a new one - * created. - */ - private BugzillaSearchData getPatternData(Combo widget, Combo operation, - ArrayList<BugzillaSearchData> previousSearchQueryData) { - String pattern = widget.getText(); - if (pattern == null || pattern.trim().equals("")) { //$NON-NLS-1$ - return null; - } - BugzillaSearchData match = null; - int i = previousSearchQueryData.size() - 1; - while (i >= 0) { - match = previousSearchQueryData.get(i); - if (pattern.equals(match.pattern)) { - break; - } - i--; - } - if (i >= 0 && match != null) { - match.operation = operation.getSelectionIndex(); - // remove - will be added last (see below) - previousSearchQueryData.remove(match); - } else { - match = new BugzillaSearchData(widget.getText(), operation.getSelectionIndex()); - } - previousSearchQueryData.add(match); - return match; - } - - /** - * Returns an array of previous summary patterns - */ - private String[] getPreviousPatterns(ArrayList<BugzillaSearchData> patternHistory) { - int size = patternHistory.size(); - String[] patterns = new String[size]; - for (int i = 0; i < size; i++) { - patterns[i] = (patternHistory.get(size - 1 - i)).pattern; - } - return patterns; - } - - public String getSearchURL(TaskRepository repository) { - return getQueryURL(repository, getQueryParameters()); - } - - protected String getQueryURL(TaskRepository repository, StringBuilder params) { - StringBuilder url = new StringBuilder(getQueryURLStart(repository).toString()); - url.append(params); - - // HACK make sure that the searches come back sorted by priority. This - // should be a search option though - url.append("&order=Importance"); //$NON-NLS-1$ - // url.append(BugzillaRepositoryUtil.contentTypeRDF); - return url.toString(); - } - - /** - * Creates the bugzilla query URL start. - * - * Example: https://bugs.eclipse.org/bugs/buglist.cgi? - */ - private StringBuilder getQueryURLStart(TaskRepository repository) { - StringBuilder sb = new StringBuilder(repository.getRepositoryUrl()); - - if (sb.charAt(sb.length() - 1) != '/') { - sb.append('/'); - } - sb.append("buglist.cgi?"); //$NON-NLS-1$ - return sb; - } - - /** - * Goes through the query form and builds up the query parameters. - * - * Example: short_desc_type=substring&short_desc=bla& ... TODO: The encoding here should match - * TaskRepository.getCharacterEncoding() - * - * @throws UnsupportedEncodingException - */ - protected StringBuilder getQueryParameters() { - StringBuilder sb = new StringBuilder(); - - sb.append("short_desc_type="); //$NON-NLS-1$ - sb.append(patternOperationValues[summaryOperation.getSelectionIndex()]); - appendToBuffer(sb, "&short_desc=", summaryPattern.getText()); //$NON-NLS-1$ - - int[] selected = product.getSelectionIndices(); - for (int element : selected) { - appendToBuffer(sb, "&product=", product.getItem(element)); //$NON-NLS-1$ - } - - selected = component.getSelectionIndices(); - for (int element : selected) { - appendToBuffer(sb, "&component=", component.getItem(element)); //$NON-NLS-1$ - } - - selected = version.getSelectionIndices(); - for (int element : selected) { - appendToBuffer(sb, "&version=", version.getItem(element)); //$NON-NLS-1$ - } - - selected = target.getSelectionIndices(); - for (int element : selected) { - appendToBuffer(sb, "&target_milestone=", target.getItem(element)); //$NON-NLS-1$ - } - - sb.append("&long_desc_type="); //$NON-NLS-1$ - sb.append(patternOperationValues[commentOperation.getSelectionIndex()]); - appendToBuffer(sb, "&long_desc=", commentPattern.getText()); //$NON-NLS-1$ - - selected = status.getSelectionIndices(); - for (int element : selected) { - appendToBuffer(sb, "&bug_status=", status.getItem(element)); //$NON-NLS-1$ - } - - selected = resolution.getSelectionIndices(); - for (int element : selected) { - appendToBuffer(sb, "&resolution=", resolution.getItem(element)); //$NON-NLS-1$ - } - - selected = severity.getSelectionIndices(); - for (int element : selected) { - appendToBuffer(sb, "&bug_severity=", severity.getItem(element)); //$NON-NLS-1$ - } - - selected = priority.getSelectionIndices(); - for (int element : selected) { - appendToBuffer(sb, "&priority=", priority.getItem(element)); //$NON-NLS-1$ - } - - selected = hardware.getSelectionIndices(); - for (int element : selected) { - appendToBuffer(sb, "&ref_platform=", hardware.getItem(element)); //$NON-NLS-1$ - } - - selected = os.getSelectionIndices(); - for (int element : selected) { - appendToBuffer(sb, "&op_sys=", os.getItem(element)); //$NON-NLS-1$ - } - - if (emailPattern.getText() != null && !emailPattern.getText().trim().equals("")) { //$NON-NLS-1$ - boolean selectionMade = false; - for (Button button : emailButtons) { - if (button.getSelection()) { - selectionMade = true; - break; - } - } - if (selectionMade) { - for (int i = 0; i < emailButtons.length; i++) { - if (emailButtons[i].getSelection()) { - sb.append("&"); //$NON-NLS-1$ - sb.append(emailRoleValues[i]); - sb.append("=1"); //$NON-NLS-1$ - } - } - sb.append("&emailtype1="); //$NON-NLS-1$ - sb.append(emailOperationValues[emailOperation.getSelectionIndex()]); - appendToBuffer(sb, "&email1=", emailPattern.getText()); //$NON-NLS-1$ - } - } - - if (emailPattern2.getText() != null && !emailPattern2.getText().trim().equals("")) { //$NON-NLS-1$ - boolean selectionMade = false; - for (Button button : emailButtons2) { - if (button.getSelection()) { - selectionMade = true; - break; - } - } - if (selectionMade) { - for (int i = 0; i < emailButtons2.length; i++) { - if (emailButtons2[i].getSelection()) { - sb.append("&"); //$NON-NLS-1$ - sb.append(emailRoleValues2[i]); - sb.append("=1"); //$NON-NLS-1$ - } - } - sb.append("&emailtype2="); //$NON-NLS-1$ - sb.append(emailOperationValues[emailOperation2.getSelectionIndex()]); - appendToBuffer(sb, "&email2=", emailPattern2.getText()); //$NON-NLS-1$ - } - } - - if (daysText.getText() != null && !daysText.getText().equals("")) { //$NON-NLS-1$ - try { - Integer.parseInt(daysText.getText()); - appendToBuffer(sb, "&changedin=", daysText.getText()); //$NON-NLS-1$ - } catch (NumberFormatException ignored) { - // this means that the days is not a number, so don't worry - } - } - - if (keywords.getText() != null && !keywords.getText().trim().equals("")) { //$NON-NLS-1$ - sb.append("&keywords_type="); //$NON-NLS-1$ - sb.append(keywordOperationValues[keywordsOperation.getSelectionIndex()]); - appendToBuffer(sb, "&keywords=", keywords.getText().replace(',', ' ')); //$NON-NLS-1$ - } - - return sb; - } - - private void appendToBuffer(StringBuilder sb, String key, String value) { - sb.append(key); - try { - sb.append(URLEncoder.encode(value, getTaskRepository().getCharacterEncoding())); - } catch (UnsupportedEncodingException e) { - sb.append(value); - } - } - - @Override - public IDialogSettings getDialogSettings() { - IDialogSettings settings = BugzillaUiPlugin.getDefault().getDialogSettings(); - fDialogSettings = settings.getSection(PAGE_NAME); - if (fDialogSettings == null) { - fDialogSettings = settings.addNewSection(PAGE_NAME); - } - return fDialogSettings; - } - - /** - * Initializes itself from the stored page settings. - */ - private void readConfiguration() { - getDialogSettings(); - } - - private void updateAttributesFromConfiguration(String[] selectedProducts) { - if (repositoryConfiguration == null) { - updateConfiguration(false); - } - if (repositoryConfiguration != null) { - String[] saved_product = product.getSelection(); - String[] saved_component = component.getSelection(); - String[] saved_version = version.getSelection(); - String[] saved_target = target.getSelection(); - String[] saved_status = status.getSelection(); - String[] saved_resolution = resolution.getSelection(); - String[] saved_severity = severity.getSelection(); - String[] saved_priority = priority.getSelection(); - String[] saved_hardware = hardware.getSelection(); - String[] saved_os = os.getSelection(); - - if (selectedProducts == null) { - java.util.List<String> products = repositoryConfiguration.getProducts(); - String[] productsList = products.toArray(new String[products.size()]); - Arrays.sort(productsList, String.CASE_INSENSITIVE_ORDER); - product.setItems(productsList); - } - - String[] componentsList = BugzillaUiPlugin.getQueryOptions(IBugzillaConstants.VALUES_COMPONENT, - selectedProducts, repositoryConfiguration); - Arrays.sort(componentsList, String.CASE_INSENSITIVE_ORDER); - component.setItems(componentsList); - - version.setItems(BugzillaUiPlugin.getQueryOptions(IBugzillaConstants.VALUES_VERSION, selectedProducts, - repositoryConfiguration)); - target.setItems(BugzillaUiPlugin.getQueryOptions(IBugzillaConstants.VALUES_TARGET, selectedProducts, - repositoryConfiguration)); - status.setItems(convertStringListToArray(repositoryConfiguration.getStatusValues())); - resolution.setItems(convertStringListToArray(repositoryConfiguration.getResolutions())); - severity.setItems(convertStringListToArray(repositoryConfiguration.getSeverities())); - priority.setItems(convertStringListToArray(repositoryConfiguration.getPriorities())); - hardware.setItems(convertStringListToArray(repositoryConfiguration.getPlatforms())); - os.setItems(convertStringListToArray(repositoryConfiguration.getOSs())); - - setSelection(product, saved_product); - setSelection(component, saved_component); - setSelection(version, saved_version); - setSelection(target, saved_target); - setSelection(status, saved_status); - setSelection(resolution, saved_resolution); - setSelection(severity, saved_severity); - setSelection(priority, saved_priority); - setSelection(hardware, saved_hardware); - setSelection(os, saved_os); - } - } - - @Override - public boolean canFlipToNextPage() { - // if (getErrorMessage() != null) - // return false; - // - // return true; - return false; - } - - public void handleEvent(Event event) { - if (getWizard() != null) { - getWizard().getContainer().updateButtons(); - } - } - - /** - * TODO: get rid of this? - */ - public void updateDefaults(String startingUrl) throws UnsupportedEncodingException { - // String serverName = startingUrl.substring(0, - // startingUrl.indexOf("?")); - - startingUrl = startingUrl.substring(startingUrl.indexOf("?") + 1); //$NON-NLS-1$ - String[] options = startingUrl.split("&"); //$NON-NLS-1$ - for (String option : options) { - String key = option.substring(0, option.indexOf("=")); //$NON-NLS-1$ - String value = URLDecoder.decode(option.substring(option.indexOf("=") + 1), //$NON-NLS-1$ - getTaskRepository().getCharacterEncoding()); - if (key == null) { - continue; - } - - if (key.equals("short_desc")) { //$NON-NLS-1$ - summaryPattern.setText(value); - } else if (key.equals("short_desc_type")) { //$NON-NLS-1$ - if (value.equals("allwordssubstr")) { //$NON-NLS-1$ - value = "all words"; //$NON-NLS-1$ - } else if (value.equals("anywordssubstr")) { //$NON-NLS-1$ - value = "any word"; //$NON-NLS-1$ - } - int index = 0; - for (String item : summaryOperation.getItems()) { - if (item.compareTo(value) == 0) { - break; - } - index++; - } - if (index < summaryOperation.getItemCount()) { - summaryOperation.select(index); - } - } else if (key.equals("product")) { //$NON-NLS-1$ - String[] sel = product.getSelection(); - java.util.List<String> selList = Arrays.asList(sel); - selList = new ArrayList<String>(selList); - selList.add(value); - sel = new String[selList.size()]; - product.setSelection(selList.toArray(sel)); - updateAttributesFromConfiguration(selList.toArray(sel)); - } else if (key.equals("component")) { //$NON-NLS-1$ - String[] sel = component.getSelection(); - java.util.List<String> selList = Arrays.asList(sel); - selList = new ArrayList<String>(selList); - selList.add(value); - sel = new String[selList.size()]; - component.setSelection(selList.toArray(sel)); - } else if (key.equals("version")) { //$NON-NLS-1$ - String[] sel = version.getSelection(); - java.util.List<String> selList = Arrays.asList(sel); - selList = new ArrayList<String>(selList); - selList.add(value); - sel = new String[selList.size()]; - version.setSelection(selList.toArray(sel)); - } else if (key.equals("target_milestone")) { // XXX //$NON-NLS-1$ - String[] sel = target.getSelection(); - java.util.List<String> selList = Arrays.asList(sel); - selList = new ArrayList<String>(selList); - selList.add(value); - sel = new String[selList.size()]; - target.setSelection(selList.toArray(sel)); - } else if (key.equals("version")) { //$NON-NLS-1$ - String[] sel = version.getSelection(); - java.util.List<String> selList = Arrays.asList(sel); - selList = new ArrayList<String>(selList); - selList.add(value); - sel = new String[selList.size()]; - version.setSelection(selList.toArray(sel)); - } else if (key.equals("long_desc_type")) { //$NON-NLS-1$ - if (value.equals("allwordssubstr")) { //$NON-NLS-1$ - value = "all words"; //$NON-NLS-1$ - } else if (value.equals("anywordssubstr")) { //$NON-NLS-1$ - value = "any word"; //$NON-NLS-1$ - } - int index = 0; - for (String item : commentOperation.getItems()) { - if (item.compareTo(value) == 0) { - break; - } - index++; - } - if (index < commentOperation.getItemCount()) { - commentOperation.select(index); - } - } else if (key.equals("long_desc")) { //$NON-NLS-1$ - commentPattern.setText(value); - } else if (key.equals("bug_status")) { //$NON-NLS-1$ - String[] sel = status.getSelection(); - java.util.List<String> selList = Arrays.asList(sel); - selList = new ArrayList<String>(selList); - selList.add(value); - sel = new String[selList.size()]; - status.setSelection(selList.toArray(sel)); - } else if (key.equals("resolution")) { //$NON-NLS-1$ - String[] sel = resolution.getSelection(); - java.util.List<String> selList = Arrays.asList(sel); - selList = new ArrayList<String>(selList); - selList.add(value); - sel = new String[selList.size()]; - resolution.setSelection(selList.toArray(sel)); - } else if (key.equals("bug_severity")) { //$NON-NLS-1$ - String[] sel = severity.getSelection(); - java.util.List<String> selList = Arrays.asList(sel); - selList = new ArrayList<String>(selList); - selList.add(value); - sel = new String[selList.size()]; - severity.setSelection(selList.toArray(sel)); - } else if (key.equals("priority")) { //$NON-NLS-1$ - String[] sel = priority.getSelection(); - java.util.List<String> selList = Arrays.asList(sel); - selList = new ArrayList<String>(selList); - selList.add(value); - sel = new String[selList.size()]; - priority.setSelection(selList.toArray(sel)); - } else if (key.equals("ref_platform")) { //$NON-NLS-1$ - String[] sel = hardware.getSelection(); - java.util.List<String> selList = Arrays.asList(sel); - selList = new ArrayList<String>(selList); - selList.add(value); - sel = new String[selList.size()]; - hardware.setSelection(selList.toArray(sel)); - } else if (key.equals("op_sys")) { //$NON-NLS-1$ - String[] sel = os.getSelection(); - java.util.List<String> selList = Arrays.asList(sel); - selList = new ArrayList<String>(selList); - selList.add(value); - sel = new String[selList.size()]; - os.setSelection(selList.toArray(sel)); - } else if (key.equals("emailassigned_to1")) { // HACK: email //$NON-NLS-1$ - // buttons - // assumed to be - // in same - // position - if (value.equals("1")) { //$NON-NLS-1$ - emailButtons[0].setSelection(true); - } else { - emailButtons[0].setSelection(false); - } - } else if (key.equals("emailreporter1")) { // HACK: email //$NON-NLS-1$ - // buttons assumed - // to be in same - // position - if (value.equals("1")) { //$NON-NLS-1$ - emailButtons[1].setSelection(true); - } else { - emailButtons[1].setSelection(false); - } - } else if (key.equals("emailcc1")) { // HACK: email buttons //$NON-NLS-1$ - // assumed to be in same - // position - if (value.equals("1")) { //$NON-NLS-1$ - emailButtons[2].setSelection(true); - } else { - emailButtons[2].setSelection(false); - } - } else if (key.equals("emaillongdesc1")) { // HACK: email //$NON-NLS-1$ - // buttons assumed - // to be in same - // position - if (value.equals("1")) { //$NON-NLS-1$ - emailButtons[3].setSelection(true); - } else { - emailButtons[3].setSelection(false); - } - } else if (key.equals("emailtype1")) { //$NON-NLS-1$ - int index = 0; - for (String item : emailOperation.getItems()) { - if (item.compareTo(value) == 0) { - break; - } - index++; - } - if (index < emailOperation.getItemCount()) { - emailOperation.select(index); - } - } else if (key.equals("email1")) { //$NON-NLS-1$ - emailPattern.setText(value); - } else if (key.equals("emailassigned_to2")) { // HACK: email //$NON-NLS-1$ - // buttons - // assumed to be - // in same - // position - if (value.equals("1")) { //$NON-NLS-1$ - emailButtons2[0].setSelection(true); - } else { - emailButtons2[0].setSelection(false); - } - } else if (key.equals("emailreporter2")) { // HACK: email //$NON-NLS-1$ - // buttons assumed - // to be in same - // position - if (value.equals("1")) { //$NON-NLS-1$ - emailButtons2[1].setSelection(true); - } else { - emailButtons2[1].setSelection(false); - } - } else if (key.equals("emailcc2")) { // HACK: email buttons //$NON-NLS-1$ - // assumed to be in same - // position - if (value.equals("1")) { //$NON-NLS-1$ - emailButtons2[2].setSelection(true); - } else { - emailButtons2[2].setSelection(false); - } - } else if (key.equals("emaillongdesc2")) { // HACK: email //$NON-NLS-1$ - // buttons assumed - // to be in same - // position - if (value.equals("1")) { //$NON-NLS-1$ - emailButtons2[3].setSelection(true); - } else { - emailButtons2[3].setSelection(false); - } - } else if (key.equals("emailtype2")) { //$NON-NLS-1$ - int index = 0; - for (String item : emailOperation2.getItems()) { - if (item.compareTo(value) == 0) { - break; - } - index++; - } - if (index < emailOperation2.getItemCount()) { - emailOperation2.select(index); - } - } else if (key.equals("email2")) { //$NON-NLS-1$ - emailPattern2.setText(value); - } else if (key.equals("changedin")) { //$NON-NLS-1$ - daysText.setText(value); - } else if (key.equals("keywords")) { //$NON-NLS-1$ - keywords.setText(value.replace(' ', ',')); - } else if (key.equals("keywords_type")) { //$NON-NLS-1$ - int index = 0; - for (String item : keywordOperationValues) { - if (item.equals(value)) { - keywordsOperation.select(index); - break; - } - index++; - } - } - } - } - - private String[] nonNullArray(IDialogSettings settings, String id) { - String[] value = settings.getArray(id); - if (value == null) { - return new String[] {}; - } - return value; - } - - private void restoreWidgetValues() { - try { - IDialogSettings settings = getDialogSettings(); - String repoId = "." + getTaskRepository().getRepositoryUrl(); //$NON-NLS-1$ - if (!restoreQueryOptions || settings.getArray(STORE_PRODUCT_ID + repoId) == null || product == null) { - return; - } - - // set widgets to stored values - product.setSelection(nonNullArray(settings, STORE_PRODUCT_ID + repoId)); - component.setSelection(nonNullArray(settings, STORE_COMPONENT_ID + repoId)); - version.setSelection(nonNullArray(settings, STORE_VERSION_ID + repoId)); - target.setSelection(nonNullArray(settings, STORE_MSTONE_ID + repoId)); - status.setSelection(nonNullArray(settings, STORE_STATUS_ID + repoId)); - resolution.setSelection(nonNullArray(settings, STORE_RESOLUTION_ID + repoId)); - severity.setSelection(nonNullArray(settings, STORE_SEVERITY_ID + repoId)); - priority.setSelection(nonNullArray(settings, STORE_PRIORITY_ID + repoId)); - hardware.setSelection(nonNullArray(settings, STORE_HARDWARE_ID + repoId)); - os.setSelection(nonNullArray(settings, STORE_OS_ID + repoId)); - summaryOperation.select(settings.getInt(STORE_SUMMARYMATCH_ID + repoId)); - commentOperation.select(settings.getInt(STORE_COMMENTMATCH_ID + repoId)); - emailOperation.select(settings.getInt(STORE_EMAILMATCH_ID + repoId)); - for (int i = 0; i < emailButtons.length; i++) { - emailButtons[i].setSelection(settings.getBoolean(STORE_EMAILBUTTON_ID + i + repoId)); - } - summaryPattern.setText(settings.get(STORE_SUMMARYTEXT_ID + repoId)); - commentPattern.setText(settings.get(STORE_COMMENTTEXT_ID + repoId)); - emailPattern.setText(settings.get(STORE_EMAILADDRESS_ID + repoId)); - try { - emailOperation2.select(settings.getInt(STORE_EMAIL2MATCH_ID + repoId)); - } catch (Exception e) { - //ignore - } - for (int i = 0; i < emailButtons2.length; i++) { - emailButtons2[i].setSelection(settings.getBoolean(STORE_EMAIL2BUTTON_ID + i + repoId)); - } - emailPattern2.setText(settings.get(STORE_EMAIL2ADDRESS_ID + repoId)); - if (settings.get(STORE_KEYWORDS_ID + repoId) != null) { - keywords.setText(settings.get(STORE_KEYWORDS_ID + repoId)); - keywordsOperation.select(settings.getInt(STORE_KEYWORDSMATCH_ID + repoId)); - } - } catch (IllegalArgumentException e) { - //ignore - } - } - - @Override - public void saveState() { - String repoId = "." + getTaskRepository().getRepositoryUrl(); //$NON-NLS-1$ - IDialogSettings settings = getDialogSettings(); - settings.put(STORE_PRODUCT_ID + repoId, product.getSelection()); - settings.put(STORE_COMPONENT_ID + repoId, component.getSelection()); - settings.put(STORE_VERSION_ID + repoId, version.getSelection()); - settings.put(STORE_MSTONE_ID + repoId, target.getSelection()); - settings.put(STORE_STATUS_ID + repoId, status.getSelection()); - settings.put(STORE_RESOLUTION_ID + repoId, resolution.getSelection()); - settings.put(STORE_SEVERITY_ID + repoId, severity.getSelection()); - settings.put(STORE_PRIORITY_ID + repoId, priority.getSelection()); - settings.put(STORE_HARDWARE_ID + repoId, hardware.getSelection()); - settings.put(STORE_OS_ID + repoId, os.getSelection()); - settings.put(STORE_SUMMARYMATCH_ID + repoId, summaryOperation.getSelectionIndex()); - settings.put(STORE_COMMENTMATCH_ID + repoId, commentOperation.getSelectionIndex()); - settings.put(STORE_EMAILMATCH_ID + repoId, emailOperation.getSelectionIndex()); - for (int i = 0; i < emailButtons.length; i++) { - settings.put(STORE_EMAILBUTTON_ID + i + repoId, emailButtons[i].getSelection()); - } - settings.put(STORE_SUMMARYTEXT_ID + repoId, summaryPattern.getText()); - settings.put(STORE_COMMENTTEXT_ID + repoId, commentPattern.getText()); - settings.put(STORE_EMAILADDRESS_ID + repoId, emailPattern.getText()); - settings.put(STORE_EMAIL2ADDRESS_ID + repoId, emailPattern2.getText()); - settings.put(STORE_EMAIL2MATCH_ID + repoId, emailOperation2.getSelectionIndex()); - for (int i = 0; i < emailButtons2.length; i++) { - settings.put(STORE_EMAIL2BUTTON_ID + i + repoId, emailButtons2[i].getSelection()); - } - - settings.put(STORE_KEYWORDS_ID + repoId, keywords.getText()); - settings.put(STORE_KEYWORDSMATCH_ID + repoId, keywordsOperation.getSelectionIndex()); - // settings.put(STORE_REPO_ID, repositoryCombo.getText()); - } - - private void saveBounds(Rectangle bounds) { - if (inSearchContainer()) { - return; - } - - IDialogSettings settings = getDialogSettings(); - IDialogSettings dialogBounds = settings.getSection(DIALOG_BOUNDS_KEY); - if (dialogBounds == null) { - dialogBounds = new DialogSettings(DIALOG_BOUNDS_KEY); - settings.addSection(dialogBounds); - } - dialogBounds.put(X, bounds.x); - dialogBounds.put(Y, bounds.y); - dialogBounds.put(WIDTH, bounds.width); - dialogBounds.put(HEIGHT, bounds.height); - } - - private void restoreBounds() { - if (inSearchContainer()) { - return; - } - - IDialogSettings settings = getDialogSettings(); - IDialogSettings dialogBounds = settings.getSection(DIALOG_BOUNDS_KEY); - Shell shell = getShell(); - if (shell != null) { - Rectangle bounds = shell.getBounds(); - - if (bounds != null && dialogBounds != null) { - try { - bounds.x = dialogBounds.getInt(X); - bounds.y = dialogBounds.getInt(Y); - bounds.height = dialogBounds.getInt(HEIGHT); - bounds.width = dialogBounds.getInt(WIDTH); - shell.setBounds(bounds); - } catch (NumberFormatException e) { - // silently ignored - } - } - } - - } - - /* Testing hook to see if any products are present */ - public int getProductCount() throws Exception { - return product.getItemCount(); - } - - public boolean isRestoreQueryOptions() { - return restoreQueryOptions; - } - - public void setRestoreQueryOptions(boolean restoreQueryOptions) { - this.restoreQueryOptions = restoreQueryOptions; - } - - private String[] convertStringListToArray(java.util.List<String> stringList) { - return stringList.toArray(new String[stringList.size()]); - } - - private void updateConfiguration(final boolean force) { - if (getTaskRepository() != null) { - IRunnableWithProgress updateRunnable = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - if (monitor == null) { - monitor = new NullProgressMonitor(); - } - try { - monitor.beginTask(Messages.BugzillaSearchPage_Updating_search_options_, - IProgressMonitor.UNKNOWN); - repositoryConfiguration = BugzillaCorePlugin.getRepositoryConfiguration(getTaskRepository(), - force, monitor); - } catch (final Exception e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }; - - try { - // TODO: make cancelable (bug 143011) - if (getContainer() != null) { - getContainer().run(true, true, updateRunnable); - } else if (getSearchContainer() != null) { - getSearchContainer().getRunnableContext().run(true, true, updateRunnable); - } else { - IProgressService service = PlatformUI.getWorkbench().getProgressService(); - service.busyCursorWhile(updateRunnable); - } - - } catch (InvocationTargetException ex) { - Shell shell = null; - shell = getShell(); - if (ex.getCause() instanceof CoreException) { - CoreException cause = ((CoreException) ex.getCause()); - if (cause.getStatus() instanceof RepositoryStatus - && ((RepositoryStatus) cause.getStatus()).isHtmlMessage()) { - // TOOD: use StatusManager - -// this.setControlsEnabled(false); -// scontainer.setPerformActionEnabled(false); - if (shell != null) { - shell.setEnabled(false); - } - // TODO: eliminate use of internal api - WebBrowserDialog dialog = new WebBrowserDialog(shell, - Messages.BugzillaSearchPage_Error_updating_search_options, null, cause.getStatus() - .getMessage(), NONE, new String[] { IDialogConstants.OK_LABEL }, 0, - ((RepositoryStatus) cause.getStatus()).getHtmlMessage()); - dialog.setBlockOnOpen(true); - dialog.open(); - if (shell != null) { - shell.setEnabled(true); - } - return; -// this.setPageComplete(this.isPageComplete()); -// this.setControlsEnabled(true); - } else { - StatusHandler.log(new Status(IStatus.ERROR, BugzillaUiPlugin.ID_PLUGIN, cause.getMessage(), - cause)); - } - } - if (ex.getCause() instanceof OperationCanceledException) { - return; - } - - MessageDialog.openError(shell, Messages.BugzillaSearchPage_Error_updating_search_options, - MessageFormat.format(Messages.BugzillaSearchPage_Error_was_X, ex.getCause().getMessage())); - return; - - } catch (InterruptedException ex) { - return; - } - - updateAttributesFromConfiguration(null); - } - } - - @Override - public Shell getShell() { - Shell shell = null; - if (getWizard() != null && getWizard().getContainer() != null) { - shell = getWizard().getContainer().getShell(); - } - if (shell == null && getControl() != null) { - shell = getControl().getShell(); - } - return shell; - } - - @Override - public String getQueryTitle() { - return (queryTitle != null) ? queryTitle.getText() : ""; //$NON-NLS-1$ - } - - private void setSelection(List listControl, String[] selection) { - for (String item : selection) { - int index = listControl.indexOf(item); - if (index > -1) { - listControl.select(index); - } - } - if (listControl.getSelectionCount() > 0) { - listControl.showSelection(); - } else { - listControl.select(0); - listControl.showSelection(); - listControl.deselectAll(); - } - - } - - @Override - public void applyTo(IRepositoryQuery query) { - query.setUrl(getQueryURL(getTaskRepository(), getQueryParameters())); - query.setSummary(getQueryTitle()); - Shell shell = getShell(); - if (shell != null) { - saveBounds(shell.getBounds()); - } - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSeveritySearchSorter.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSeveritySearchSorter.java deleted file mode 100644 index 915a683d8..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSeveritySearchSorter.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.search; - -import org.eclipse.core.resources.IMarker; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin; - -/** - * Sorts results of Bugzilla search by bug severity. - */ -public class BugzillaSeveritySearchSorter extends ViewerSorter { - - /** - * Returns a negative, zero, or positive number depending on whether the first bug's severity goes before, is the - * same as, or goes after the second element's severity. - * <p> - * - * @see org.eclipse.jface.viewers.ViewerSorter#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, - * java.lang.Object) - */ - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - try { - // cast the object and get its severity - IMarker entry1 = (IMarker) e1; - Integer severity1 = (Integer) entry1.getAttribute(BugzillaUiPlugin.HIT_MARKER_ATTR_SEVERITY); - - // cast the other object and get its severity - IMarker entry2 = (IMarker) e2; - Integer severity2 = (Integer) entry2.getAttribute(BugzillaUiPlugin.HIT_MARKER_ATTR_SEVERITY); - - // if neither is null, compare the bugs severities - if (severity1 != null && severity2 != null) { - return severity1.compareTo(severity2); - } - } catch (Exception ignored) { - // ignore if there is a problem - } - - // if that didn't work, use the default compare method - return super.compare(viewer, e1, e2); - } - - /** - * Returns the category of the given element. The category is a number used to allocate elements to bins; the bins - * are arranged in ascending numeric order. The elements within a bin are arranged via a second level sort - * criterion. - * <p> - * - * @see org.eclipse.jface.viewers.ViewerSorter#category(Object) - */ - @Override - public int category(Object element) { - try { - IMarker marker = (IMarker) element; - - // return the bugs id - if (marker.getType().equals(BugzillaUiPlugin.HIT_MARKER_ID)) { - return ((Integer) marker.getAttribute(BugzillaUiPlugin.HIT_MARKER_ATTR_ID)).intValue(); - } - } catch (Exception ignored) { - // ignore if there is a problem - } - - // if that didn't work, use the default category method - return super.category(element); - } -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaStateSearchSorter.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaStateSearchSorter.java deleted file mode 100644 index 29f1afabe..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaStateSearchSorter.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.search; - -import org.eclipse.core.resources.IMarker; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin; - -/** - * Sorts results of Bugzilla search by bug state. - */ -public class BugzillaStateSearchSorter extends ViewerSorter { - - /** - * Returns a negative, zero, or positive number depending on whether the first bug's state goes before, is the same - * as, or goes after the second element's state. - * <p> - * - * @see org.eclipse.jface.viewers.ViewerSorter#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, - * java.lang.Object) - */ - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - try { - // cast the object and get its state - IMarker entry1 = (IMarker) e1; - Integer state1 = (Integer) entry1.getAttribute(BugzillaUiPlugin.HIT_MARKER_ATTR_STATE); - - // cast the other object and get its state - IMarker entry2 = (IMarker) e2; - Integer state2 = (Integer) entry2.getAttribute(BugzillaUiPlugin.HIT_MARKER_ATTR_STATE); - - // if neither is null, compare the bugs states - if (state1 != null && state2 != null) { - // compare the states - int rc = state1.compareTo(state2); - - // compare the resolution if the states are the same - if (rc == 0) { - // get the resolution of the bug - Integer result1 = (Integer) entry1.getAttribute(BugzillaUiPlugin.HIT_MARKER_ATTR_RESULT); - - // get the resolution of the other bug - Integer result2 = (Integer) entry2.getAttribute(BugzillaUiPlugin.HIT_MARKER_ATTR_RESULT); - - // if neither state is null, compare them - if (result1 != null && result2 != null) { - rc = result1.compareTo(result2); - } - } - return rc; - } - - } catch (Exception ignored) { - // ignore if there is a problem - } - - // if that didn't work, use the default compare method - return super.compare(viewer, e1, e2); - } - - /** - * Returns the category of the given element. The category is a number used to allocate elements to bins; the bins - * are arranged in ascending numeric order. The elements within a bin are arranged via a second level sort - * criterion. - * <p> - * - * @see org.eclipse.jface.viewers.ViewerSorter#category(Object) - */ - @Override - public int category(Object element) { - try { - IMarker marker = (IMarker) element; - - // return the bugs id - if (marker.getType().equals(BugzillaUiPlugin.HIT_MARKER_ID)) { - return ((Integer) marker.getAttribute(BugzillaUiPlugin.HIT_MARKER_ATTR_ID)).intValue(); - } - } catch (Exception ignored) { - // ignore if there is a problem - } - - // if that didn't work, use the default category method - return super.category(element); - } -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/Messages.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/Messages.java deleted file mode 100644 index af17d44d9..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/Messages.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.search; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.bugzilla.ui.search.messages"; //$NON-NLS-1$ - - static { - // load message values from bundle file - reloadMessages(); - } - - public static void reloadMessages() { - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - public static String BugzillaSearchPage_all; - - public static String BugzillaSearchPage_all_words; - - public static String BugzillaSearchPage_any; - - public static String BugzillaSearchPage_any_word; - - public static String BugzillaSearchPage_Bugzilla_Query; - - public static String BugzillaSearchPage_Bugzilla_Search_Page; - - public static String BugzillaSearchPage_cc; - - public static String BugzillaSearchPage_Changed_in; - - public static String BugzillaSearchPage_Comment; - - public static String BugzillaSearchPage_commenter; - - public static String BugzillaSearchPage_Component; - - public static String BugzillaSearchPage_days; - - public static String BugzillaSearchPage_Email; - - public static String BugzillaSearchPage_Email_2; - - public static String BugzillaSearchPage_Error_updating_search_options; - - public static String BugzillaSearchPage_Error_was_X; - - public static String BugzillaSearchPage_exact; - - public static String BugzillaSearchPage_Hardware; - - public static String BugzillaSearchPage_Keywords; - - public static String BugzillaSearchPage_Milestone; - - public static String BugzillaSearchPage_No_repository_available; - - public static String BugzillaSearchPage_none; - - public static String BugzillaSearchPage_notregexp; - - public static String BugzillaSearchPage_Number_of_days_must_be_a_positive_integer; - - public static String BugzillaSearchPage_Operating_System; - - public static String BugzillaSearchPage_owner; - - public static String BugzillaSearchPage_Product; - - public static String BugzillaSearchPage_PROORITY; - - public static String BugzillaSearchPage_Query_Title; - - public static String BugzillaSearchPage_regexp; - - public static String BugzillaSearchPage_reporter; - - public static String BugzillaSearchPage_Resolution; - - public static String BugzillaSearchPage_Select_; - - public static String BugzillaSearchPage_Select_the_Bugzilla_query_parameters; - - public static String BugzillaSearchPage_Severity; - - public static String BugzillaSearchPage_Status; - - public static String BugzillaSearchPage_substring; - - public static String BugzillaSearchPage_Summary; - - public static String BugzillaSearchPage_Task_Repositories; - - public static String BugzillaSearchPage_Unable_to_get_configuration_X; - - public static String BugzillaSearchPage_Update_Attributes_from_Repository; - - public static String BugzillaSearchPage_Updating_search_options_; - - public static String BugzillaSearchPage_Version; -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/messages.properties b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/messages.properties deleted file mode 100644 index 7cbdeee9b..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/messages.properties +++ /dev/null @@ -1,43 +0,0 @@ -BugzillaSearchPage_all=all -BugzillaSearchPage_all_words=all words -BugzillaSearchPage_any=any -BugzillaSearchPage_any_word=any word -BugzillaSearchPage_Bugzilla_Query=Bugzilla Query -BugzillaSearchPage_Bugzilla_Search_Page=Bugzilla Search Page -BugzillaSearchPage_cc=cc -BugzillaSearchPage_Changed_in=Ch&anged in: -BugzillaSearchPage_Comment=&Comment: -BugzillaSearchPage_commenter=commenter -BugzillaSearchPage_Component=Compo&nent: -BugzillaSearchPage_days=\ days. -BugzillaSearchPage_Email=&Email: -BugzillaSearchPage_Email_2=Email &2: -BugzillaSearchPage_Error_updating_search_options=Error updating search options -BugzillaSearchPage_Error_was_X=Error was: {0} -BugzillaSearchPage_exact=exact -BugzillaSearchPage_Hardware=Hard&ware: -BugzillaSearchPage_Keywords=&Keywords: -BugzillaSearchPage_Milestone=&Milestone: -BugzillaSearchPage_No_repository_available=No repository available, please add one using the Task Repositories view. -BugzillaSearchPage_none=none -BugzillaSearchPage_notregexp=notregexp -BugzillaSearchPage_Number_of_days_must_be_a_positive_integer=Number of days must be a positive integer. {0} is invalid. -BugzillaSearchPage_Operating_System=&Operating System: -BugzillaSearchPage_owner=owner -BugzillaSearchPage_Product=&Product: -BugzillaSearchPage_PROORITY=Priori&ty: -BugzillaSearchPage_Query_Title=&Query Title: -BugzillaSearchPage_regexp=regexp -BugzillaSearchPage_reporter=reporter -BugzillaSearchPage_Resolution=&Resolution: -BugzillaSearchPage_Select_=Select... -BugzillaSearchPage_Select_the_Bugzilla_query_parameters=Select the Bugzilla query parameters. Use the Update Attributes button to retrieve updated values from the repository. -BugzillaSearchPage_Severity=Se&verity: -BugzillaSearchPage_Status=Stat&us: -BugzillaSearchPage_substring=substring -BugzillaSearchPage_Summary=Summar&y: -BugzillaSearchPage_Task_Repositories=Task Repositories -BugzillaSearchPage_Unable_to_get_configuration_X=Unable to get configuration. Ensure proper repository configuration in {0} -BugzillaSearchPage_Update_Attributes_from_Repository=Up&date Attributes from Repository -BugzillaSearchPage_Updating_search_options_=Updating search options... -BugzillaSearchPage_Version=Vers&ion: diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java deleted file mode 100644 index 70fab643d..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java +++ /dev/null @@ -1,221 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - * Eugene Kuleshov - improvements - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.tasklist; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.Region; -import org.eclipse.jface.text.hyperlink.IHyperlink; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; -import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; -import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaImages; -import org.eclipse.mylyn.internal.bugzilla.ui.search.BugzillaSearchPage; -import org.eclipse.mylyn.internal.bugzilla.ui.wizard.NewBugzillaTaskWizard; -import org.eclipse.mylyn.tasks.core.IRepositoryQuery; -import org.eclipse.mylyn.tasks.core.ITask; -import org.eclipse.mylyn.tasks.core.ITaskComment; -import org.eclipse.mylyn.tasks.core.ITaskMapping; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.core.data.TaskAttachmentModel; -import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi; -import org.eclipse.mylyn.tasks.ui.LegendElement; -import org.eclipse.mylyn.tasks.ui.TaskHyperlink; -import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage; -import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage; -import org.eclipse.mylyn.tasks.ui.wizards.RepositoryQueryWizard; - -/** - * @author Mik Kersten - */ -public class BugzillaConnectorUi extends AbstractRepositoryConnectorUi { - - private static final String regexp = "(duplicate of|bug|task)( ?#? ?)(\\d+)"; //$NON-NLS-1$ - - private static final Pattern PATTERN = Pattern.compile(regexp, Pattern.CASE_INSENSITIVE); - - @Override - public String getAccountCreationUrl(TaskRepository taskRepository) { - return taskRepository.getRepositoryUrl() + "/createaccount.cgi"; //$NON-NLS-1$ - } - - @Override - public String getAccountManagementUrl(TaskRepository taskRepository) { - return taskRepository.getRepositoryUrl() + "/userprefs.cgi"; //$NON-NLS-1$ - } - - @Override - public String getTaskHistoryUrl(TaskRepository taskRepository, ITask task) { - return taskRepository.getRepositoryUrl() + IBugzillaConstants.URL_BUG_ACTIVITY + task.getTaskId(); - } - - @Override - public String getReplyText(TaskRepository taskRepository, ITask task, ITaskComment taskComment, boolean includeTask) { - if (taskComment == null) { - return Messages.BugzillaConnectorUi__In_reply_to_comment_0_; - } else if (includeTask) { - return MessageFormat.format(Messages.BugzillaConnectorUi__In_reply_to_X_comment_X_, task.getTaskKey(), - taskComment.getNumber()); - } else { - return MessageFormat.format(Messages.BugzillaConnectorUi__In_reply_to_comment_X_, taskComment.getNumber()); - } - } - - private static final int TASK_NUM_GROUP = 3; - - @Override - public List<LegendElement> getLegendElements() { - List<LegendElement> legendItems = new ArrayList<LegendElement>(); - legendItems.add(LegendElement.createTask("blocker", BugzillaImages.OVERLAY_CRITICAL)); //$NON-NLS-1$ - legendItems.add(LegendElement.createTask("critical", BugzillaImages.OVERLAY_CRITICAL)); //$NON-NLS-1$ - legendItems.add(LegendElement.createTask("major", BugzillaImages.OVERLAY_MAJOR)); //$NON-NLS-1$ - legendItems.add(LegendElement.createTask("enhancement", BugzillaImages.OVERLAY_ENHANCEMENT)); //$NON-NLS-1$ - legendItems.add(LegendElement.createTask("trivial", BugzillaImages.OVERLAY_MINOR)); //$NON-NLS-1$ - return legendItems; - } - - @Override - public ImageDescriptor getTaskKindOverlay(ITask task) { - String severity = task.getAttribute(BugzillaAttribute.BUG_SEVERITY.getKey()); - if (severity != null) { - // XXX: refactor to use configuration - if ("blocker".equals(severity) || "critical".equals(severity)) { //$NON-NLS-1$ //$NON-NLS-2$ - return BugzillaImages.OVERLAY_CRITICAL; - } else if ("major".equals(severity)) { //$NON-NLS-1$ - return BugzillaImages.OVERLAY_MAJOR; - } else if ("enhancement".equals(severity)) { //$NON-NLS-1$ - return BugzillaImages.OVERLAY_ENHANCEMENT; - } else if ("trivial".equals(severity) || "minor".equals(severity)) { //$NON-NLS-1$ //$NON-NLS-2$ - return BugzillaImages.OVERLAY_MINOR; - } else { - return null; - } - } - return super.getTaskKindOverlay(task); - } - - @Override - public IHyperlink[] findHyperlinks(TaskRepository repository, String text, int index, int textOffset) { - ArrayList<IHyperlink> hyperlinksFound = null; - - Matcher m = PATTERN.matcher(text); - while (m.find()) { - if (index == -1 || (index >= m.start() && index <= m.end())) { - IHyperlink link = extractHyperlink(repository, textOffset, m); - if (link != null) { - if (hyperlinksFound == null) { - hyperlinksFound = new ArrayList<IHyperlink>(); - } - hyperlinksFound.add(link); - } - } - } - - return (hyperlinksFound != null) ? hyperlinksFound.toArray(new IHyperlink[0]) : null; - } - - @Override - public String getTaskKindLabel(ITask repositoryTask) { - return IBugzillaConstants.BUGZILLA_TASK_KIND; - } - - @Override - public ITaskRepositoryPage getSettingsPage(TaskRepository taskRepository) { - return new BugzillaRepositorySettingsPage(taskRepository); - } - - @Override - public AbstractRepositoryQueryPage getSearchPage(TaskRepository repository, IStructuredSelection selection) { - return new BugzillaSearchPage(repository); - } - - @Override - public IWizard getNewTaskWizard(TaskRepository taskRepository, ITaskMapping selection) { - return new NewBugzillaTaskWizard(taskRepository, selection); - } - - @Override - public IWizard getQueryWizard(TaskRepository repository, IRepositoryQuery query) { - RepositoryQueryWizard wizard = new RepositoryQueryWizard(repository); - if (query == null) { - wizard.addPage(new BugzillaQueryTypeWizardPage(repository)); - } else { - if (isCustomQuery(query)) { - wizard.addPage(new BugzillaCustomQueryWizardPage(repository, query)); - } else { - wizard.addPage(new BugzillaSearchPage(repository, query)); - } - } - return wizard; - } - - @Override - public boolean hasSearchPage() { - return true; - } - - @Override - public String getConnectorKind() { - return BugzillaCorePlugin.CONNECTOR_KIND; - } - - private boolean isCustomQuery(IRepositoryQuery query2) { - String custom = query2.getAttribute(IBugzillaConstants.ATTRIBUTE_BUGZILLA_QUERY_CUSTOM); - return custom != null && custom.equals(Boolean.TRUE.toString()); - } - - private static IHyperlink extractHyperlink(TaskRepository repository, int regionOffset, Matcher m) { - - int start = -1; - - if (m.group().startsWith("duplicate")) { //$NON-NLS-1$ - start = m.start() + m.group().indexOf(m.group(TASK_NUM_GROUP)); - } else { - start = m.start(); - } - - int end = m.end(); - - if (end == -1) { - end = m.group().length(); - } - - try { - - String bugId = m.group(TASK_NUM_GROUP).trim(); - start += regionOffset; - end += regionOffset; - - IRegion sregion = new Region(start, end - start); - return new TaskHyperlink(sregion, repository, bugId); - - } catch (NumberFormatException e) { - return null; - } - } - - @Override - public IWizardPage getTaskAttachmentPage(TaskAttachmentModel model) { - return new BugzillaTaskAttachmentPage(model); - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryDialog.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryDialog.java deleted file mode 100644 index 1e309a6f7..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryDialog.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.tasklist; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * - * @author Shawn Minto - * @author Mik Kersten - */ -public class BugzillaCustomQueryDialog extends Dialog { - private String url; - - private String name = ""; //$NON-NLS-1$ - - private String startingUrl = null; - - private String maxHits; - - private Text maxHitsText; - - private Text nameText; - - private Text queryText; - - public BugzillaCustomQueryDialog(Shell parentShell, String queryString, String description, String maxHits) { - super(parentShell); - this.startingUrl = queryString; - this.maxHits = maxHits; - this.name = description; - } - - public String getName() { - return name; - } - - public String getUrl() { - return url; - } - - public String getMaxHits() { - return maxHits; - } - - @Override - protected Control createContents(Composite parent) { - Composite custom = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(2, false); - custom.setLayout(gl); - - Label l = new Label(custom, SWT.NONE); - l.setText(Messages.BugzillaCustomQueryDialog_Bugzilla_Query_Category_Name); - - nameText = new Text(custom, SWT.BORDER | SWT.SINGLE); - if (name != null) { - nameText.setText(name); - } - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.widthHint = 300; - nameText.setLayoutData(gd); - - l = new Label(custom, SWT.NONE); - l.setText(Messages.BugzillaCustomQueryDialog_Max_Hits_Returned__1_means_all_); - - maxHitsText = new Text(custom, SWT.BORDER | SWT.SINGLE); - if (maxHits != null) { - maxHitsText.setText(maxHits); - } - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.widthHint = 300; - maxHitsText.setLayoutData(gd); - - l = new Label(custom, SWT.NONE); - l.setText(Messages.BugzillaCustomQueryDialog_Query_URL); - - queryText = new Text(custom, SWT.BORDER | SWT.SINGLE); - if (startingUrl != null) { - queryText.setText(startingUrl); - } - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.widthHint = 300; - queryText.setLayoutData(gd); - - Control c = super.createContents(parent); - - return c; - } - - @Override - protected void okPressed() { - // TODO validate the values - url = queryText.getText(); - name = nameText.getText(); - maxHits = maxHitsText.getText(); - super.okPressed(); - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java deleted file mode 100644 index cdea8260a..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - * Eugene Kuleshov - improvements - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.tasklist; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; -import org.eclipse.mylyn.tasks.core.IRepositoryQuery; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.ui.TasksUiImages; -import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -/** - * @author Rob Elves - * @author Mik Kersten - * @author Eugene Kuleshov - */ -public class BugzillaCustomQueryWizardPage extends AbstractRepositoryQueryPage { - - private static final String LABEL_CUSTOM_TITLE = Messages.BugzillaCustomQueryWizardPage_Query_Title; - - private static final String LABEL_CUSTOM_QUERY = Messages.BugzillaCustomQueryWizardPage_Query_URL; - - private static final String TITLE = Messages.BugzillaCustomQueryWizardPage_Create_query_from_URL; - - private static final String DESCRIPTION = Messages.BugzillaCustomQueryWizardPage_Enter_the_title_and_URL_for_the_query; - - private Text queryText; - - private final IRepositoryQuery query; - - private Text queryTitle; - - public BugzillaCustomQueryWizardPage(TaskRepository repository, IRepositoryQuery query) { - super(TITLE, repository); - this.query = query; - setTitle(TITLE); - setDescription(DESCRIPTION); - setImageDescriptor(TasksUiImages.BANNER_REPOSITORY); - } - - public BugzillaCustomQueryWizardPage(TaskRepository repository) { - this(repository, null); - } - - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); - composite.setLayout(new GridLayout(2, false)); - setControl(composite); - - ModifyListener modifyListener = new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(isPageComplete()); - } - }; - - final Label queryTitleLabel = new Label(composite, SWT.NONE); - queryTitleLabel.setText(LABEL_CUSTOM_TITLE); - - queryTitle = new Text(composite, SWT.BORDER); - queryTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - queryTitle.addModifyListener(modifyListener); - queryTitle.setFocus(); - - final Label queryUrlLabel = new Label(composite, SWT.NONE); - queryUrlLabel.setText(LABEL_CUSTOM_QUERY); - - queryText = new Text(composite, SWT.BORDER); - final GridData gd_queryText = new GridData(SWT.FILL, SWT.CENTER, true, false); - gd_queryText.widthHint = 300; - queryText.setLayoutData(gd_queryText); - queryText.addModifyListener(modifyListener); - - if (query != null) { - queryTitle.setText(query.getSummary()); - queryText.setText(query.getUrl()); - } - Dialog.applyDialogFont(composite); - } - - @Override - public String getQueryTitle() { - return queryTitle.getText(); - } - - @Override - public boolean canFlipToNextPage() { - return false; - } - - @Override - public boolean isPageComplete() { - if (super.isPageComplete()) { - if (queryText.getText().length() > 0) { - return true; - } - setErrorMessage(Messages.BugzillaCustomQueryWizardPage_Please_specify_Query_URL); - } - return false; - } - - @Override - public void applyTo(IRepositoryQuery query) { - query.setSummary(this.getQueryTitle()); - query.setUrl(queryText.getText()); - query.setAttribute(IBugzillaConstants.ATTRIBUTE_BUGZILLA_QUERY_CUSTOM, Boolean.TRUE.toString()); - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryTypeWizardPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryTypeWizardPage.java deleted file mode 100644 index ef43545e0..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryTypeWizardPage.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.tasklist; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.mylyn.internal.bugzilla.ui.search.BugzillaSearchPage; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.ui.TasksUiImages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -/** - * @author Rob Elves - */ -public class BugzillaQueryTypeWizardPage extends WizardPage { - - private static final String BUTTON_LABEL_QUERY = Messages.BugzillaQueryTypeWizardPage_Create_query_from_existing_URL; - - private static final String BUTTON_LABEL_FORM = Messages.BugzillaQueryTypeWizardPage_Create_query_using_form; - - private static final String TITLE = Messages.BugzillaQueryTypeWizardPage_Choose_query_type; - - private static final String DESCRIPTION = Messages.BugzillaQueryTypeWizardPage_Select_from_the_available_query_types; - - private Button buttonCustom; - - private Button buttonForm; - - private Composite composite; - - private final BugzillaCustomQueryWizardPage customPage; - - private final BugzillaSearchPage searchPage; - - public BugzillaQueryTypeWizardPage(TaskRepository repository) { - super(TITLE); - setTitle(TITLE); - setDescription(DESCRIPTION); - setImageDescriptor(TasksUiImages.BANNER_REPOSITORY); - customPage = new BugzillaCustomQueryWizardPage(repository); - searchPage = new BugzillaSearchPage(repository); - searchPage.setRestoreQueryOptions(false); - } - - public void createControl(Composite parent) { - composite = new Composite(parent, SWT.NONE); - GridData gridData = new GridData(GridData.FILL_HORIZONTAL); - gridData.grabExcessVerticalSpace = false; - composite.setLayoutData(gridData); - composite.setLayout(new GridLayout(1, false)); - - buttonForm = new Button(composite, SWT.RADIO); - buttonForm.setText(BUTTON_LABEL_FORM); - buttonForm.setSelection(true); - - buttonCustom = new Button(composite, SWT.RADIO); - buttonCustom.setText(BUTTON_LABEL_QUERY); - - setPageComplete(true); - setControl(composite); - Dialog.applyDialogFont(composite); - } - - @Override - public IWizardPage getNextPage() { - if (buttonForm.getSelection()) { - searchPage.setWizard(this.getWizard()); - return searchPage; - } - customPage.setWizard(this.getWizard()); - return customPage; - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java deleted file mode 100644 index 2c202501b..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java +++ /dev/null @@ -1,348 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.tasklist; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.net.MalformedURLException; -import java.text.MessageFormat; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClientFactory; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaLanguageSettings; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaStatus; -import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; -import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration; -import org.eclipse.mylyn.tasks.core.RepositoryStatus; -import org.eclipse.mylyn.tasks.core.RepositoryTemplate; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.PlatformUI; - -/** - * @author Mik Kersten - * @author Rob Elves - */ -public class BugzillaRepositorySettingsPage extends AbstractRepositorySettingsPage { - - private static final String TOOLTIP_AUTODETECTION_ENABLED = Messages.BugzillaRepositorySettingsPage_override_auto_detection_of_platform; - - private static final String TOOLTIP_AUTODETECTION_DISABLED = Messages.BugzillaRepositorySettingsPage_available_once_repository_created; - - private static final String LABEL_SHORT_LOGINS = Messages.BugzillaRepositorySettingsPage_local_users_enabled; - - private static final String LABEL_VERSION_NUMBER = "2.18 - 3.2"; //$NON-NLS-1$ - - private static final String TITLE = Messages.BugzillaRepositorySettingsPage_bugzilla_repository_settings; - - private static final String DESCRIPTION = MessageFormat.format( - Messages.BugzillaRepositorySettingsPage_supports_bugzilla_X, LABEL_VERSION_NUMBER) - + Messages.BugzillaRepositorySettingsPage_example_do_not_include; - - protected Button autodetectPlatformOS; - - protected Combo defaultPlatformCombo; - - protected Combo defaultOSCombo; - - private Button cleanQAContact; - - private RepositoryConfiguration repositoryConfiguration = null; - - private String platform = null; - - private String os = null; - - private Combo languageSettingCombo; - - public BugzillaRepositorySettingsPage(TaskRepository taskRepository) { - super(TITLE, DESCRIPTION, taskRepository); - setNeedsAnonymousLogin(true); - setNeedsEncoding(true); - setNeedsTimeZone(false); - setNeedsHttpAuth(true); - } - - @Override - protected void repositoryTemplateSelected(RepositoryTemplate template) { - repositoryLabelEditor.setStringValue(template.label); - setUrl(template.repositoryUrl); - // setAnonymous(info.anonymous); - if (template.characterEncoding != null) { - setEncoding(template.characterEncoding); - } - getContainer().updateButtons(); - - } - - @Override - protected void createAdditionalControls(Composite parent) { - addRepositoryTemplatesToServerUrlCombo(); - - Label shortLoginLabel = new Label(parent, SWT.NONE); - shortLoginLabel.setText(LABEL_SHORT_LOGINS); - cleanQAContact = new Button(parent, SWT.CHECK | SWT.LEFT); - if (repository != null) { - boolean shortLogin = Boolean.parseBoolean(repository.getProperty(IBugzillaConstants.REPOSITORY_SETTING_SHORT_LOGIN)); - cleanQAContact.setSelection(shortLogin); - } - - if (null != repository) { - repositoryConfiguration = BugzillaCorePlugin.getRepositoryConfiguration(repository.getRepositoryUrl()); - platform = repository.getProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM); - os = repository.getProperty(IBugzillaConstants.BUGZILLA_DEF_OS); - } - - Label defaultPlatformLabel = new Label(parent, SWT.NONE); - defaultPlatformLabel.setText(Messages.BugzillaRepositorySettingsPage_AUTOTETECT_PLATFORM_AND_OS); - if (null == repository) { - defaultPlatformLabel.setToolTipText(TOOLTIP_AUTODETECTION_DISABLED); - } else { - defaultPlatformLabel.setToolTipText(TOOLTIP_AUTODETECTION_ENABLED); - } - - Composite platformOSContainer = new Composite(parent, SWT.NONE); - GridLayout gridLayout = new GridLayout(3, false); - gridLayout.marginWidth = 0; - gridLayout.marginHeight = 0; - platformOSContainer.setLayout(gridLayout); - - autodetectPlatformOS = new Button(platformOSContainer, SWT.CHECK); - autodetectPlatformOS.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - if (autodetectPlatformOS.isEnabled() && repositoryConfiguration == null - && !autodetectPlatformOS.getSelection()) { - try { - getWizard().getContainer().run(true, false, new IRunnableWithProgress() { - - public void run(IProgressMonitor monitor) throws InvocationTargetException, - InterruptedException { - try { - monitor.beginTask( - Messages.BugzillaRepositorySettingsPage_Retrieving_repository_configuration, - IProgressMonitor.UNKNOWN); - repositoryConfiguration = BugzillaCorePlugin.getRepositoryConfiguration(repository, - false, monitor); - if (repositoryConfiguration != null) { - platform = repository.getProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM); - os = repository.getProperty(IBugzillaConstants.BUGZILLA_DEF_OS); - PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { - - public void run() { - populatePlatformCombo(); - populateOsCombo(); - } - }); - } - } catch (CoreException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - - } - - }); - } catch (InvocationTargetException e1) { - if (e1.getCause() != null) { - setErrorMessage(e1.getCause().getMessage()); - } - } catch (InterruptedException e1) { - // ignore - } - } - defaultPlatformCombo.setEnabled(!autodetectPlatformOS.getSelection()); - defaultOSCombo.setEnabled(!autodetectPlatformOS.getSelection()); - } - - }); - autodetectPlatformOS.setEnabled(null != repository); - if (null == repository) { - autodetectPlatformOS.setToolTipText(TOOLTIP_AUTODETECTION_DISABLED); - } else { - autodetectPlatformOS.setToolTipText(TOOLTIP_AUTODETECTION_ENABLED); - } - autodetectPlatformOS.setSelection(null == platform && null == os); - - defaultPlatformCombo = new Combo(platformOSContainer, SWT.READ_ONLY); - populatePlatformCombo(); - - defaultOSCombo = new Combo(platformOSContainer, SWT.READ_ONLY); - populateOsCombo(); - - new Label(parent, SWT.NONE).setText(Messages.BugzillaRepositorySettingsPage_Language_); - languageSettingCombo = new Combo(parent, SWT.DROP_DOWN); - - for (BugzillaLanguageSettings bugzillaLanguageSettings : BugzillaCorePlugin.getDefault().getLanguageSettings()) { - languageSettingCombo.add(bugzillaLanguageSettings.getLanguageName()); - } - if (repository != null) { - String language = repository.getProperty(IBugzillaConstants.BUGZILLA_LANGUAGE_SETTING); - if (language != null && !language.equals("") && languageSettingCombo.indexOf(language) >= 0) { //$NON-NLS-1$ - languageSettingCombo.select(languageSettingCombo.indexOf(language)); - } - } - if (languageSettingCombo.getSelectionIndex() == -1) { - if (languageSettingCombo.indexOf(IBugzillaConstants.DEFAULT_LANG) >= 0) { - languageSettingCombo.select(languageSettingCombo.indexOf(IBugzillaConstants.DEFAULT_LANG)); - } - } - } - - private void populateOsCombo() { - if (null != repositoryConfiguration && defaultOSCombo != null) { - defaultOSCombo.removeAll(); - List<String> optionValues = repositoryConfiguration.getOSs(); - for (String option : optionValues) { - defaultOSCombo.add(option.toString()); - } - if (null != os && defaultOSCombo.indexOf(os) >= 0) { - defaultOSCombo.select(defaultOSCombo.indexOf(os)); - } else { - // remove value if no longer exists and set to All! - repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_OS); - defaultOSCombo.select(0); - } - } else { - defaultOSCombo.add(Messages.BugzillaRepositorySettingsPage_All); - defaultOSCombo.select(0); - } - defaultOSCombo.getParent().pack(true); - defaultOSCombo.setEnabled(!autodetectPlatformOS.getSelection()); - } - - private void populatePlatformCombo() { - if (null != repositoryConfiguration && defaultPlatformCombo != null) { - defaultPlatformCombo.removeAll(); - List<String> optionValues = repositoryConfiguration.getPlatforms(); - for (String option : optionValues) { - defaultPlatformCombo.add(option.toString()); - } - if (null != platform && defaultPlatformCombo.indexOf(platform) >= 0) { - defaultPlatformCombo.select(defaultPlatformCombo.indexOf(platform)); - } else { - // remove value if no longer exists and set to All! - repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM); - defaultPlatformCombo.select(0); - } - } else { - defaultPlatformCombo.add(Messages.BugzillaRepositorySettingsPage_All); - defaultPlatformCombo.select(0); - } - defaultPlatformCombo.getParent().pack(true); - defaultPlatformCombo.setEnabled(!autodetectPlatformOS.getSelection()); - } - - @Override - public void applyTo(TaskRepository repository) { - super.applyTo(repository); - repository.setProperty(IBugzillaConstants.REPOSITORY_SETTING_SHORT_LOGIN, - String.valueOf(cleanQAContact.getSelection())); - repository.setProperty(IBugzillaConstants.BUGZILLA_LANGUAGE_SETTING, languageSettingCombo.getText()); - - if (!autodetectPlatformOS.getSelection()) { - repository.setProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM, - String.valueOf(defaultPlatformCombo.getItem(defaultPlatformCombo.getSelectionIndex()))); - repository.setProperty(IBugzillaConstants.BUGZILLA_DEF_OS, - String.valueOf(defaultOSCombo.getItem(defaultOSCombo.getSelectionIndex()))); - } else { - repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM); - repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_OS); - } - } - - @Override - protected boolean isValidUrl(String url) { - return BugzillaClient.isValidUrl(url); - } - - @Override - protected Validator getValidator(TaskRepository repository) { - return new BugzillaValidator(repository); - } - - public class BugzillaValidator extends Validator { - - final TaskRepository repository; - - public BugzillaValidator(TaskRepository repository) { - this.repository = repository; - } - - @Override - public void run(IProgressMonitor monitor) throws CoreException { - try { - validate(monitor); - } catch (Exception e) { - displayError(repository.getRepositoryUrl(), e); - } - } - - private void displayError(final String serverUrl, Throwable e) { - IStatus status; - if (e instanceof MalformedURLException) { - status = new BugzillaStatus(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_NETWORK, Messages.BugzillaRepositorySettingsPage_Server_URL_is_invalid); - } else if (e instanceof CoreException) { - status = ((CoreException) e).getStatus(); - } else if (e instanceof IOException) { - status = new BugzillaStatus(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN, RepositoryStatus.ERROR_IO, - serverUrl, e.getMessage()); - } else { - status = new BugzillaStatus(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_NETWORK, serverUrl, e.getMessage()); - } - setStatus(status); - } - - public void validate(IProgressMonitor monitor) throws IOException, CoreException { - - if (monitor == null) { - monitor = new NullProgressMonitor(); - } - try { - monitor.beginTask(Messages.BugzillaRepositorySettingsPage_Validating_server_settings, - IProgressMonitor.UNKNOWN); - BugzillaClient client = null; - - client = BugzillaClientFactory.createClient(repository); - client.validate(monitor); - } finally { - monitor.done(); - } - } - - } - - @Override - public String getConnectorKind() { - return BugzillaCorePlugin.CONNECTOR_KIND; - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskAttachmentPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskAttachmentPage.java deleted file mode 100644 index dab720840..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskAttachmentPage.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.tasklist; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaFlag; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaFlagMapper; -import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration; -import org.eclipse.mylyn.tasks.core.data.TaskAttachmentModel; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.ui.wizards.TaskAttachmentPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.forms.events.ExpansionAdapter; -import org.eclipse.ui.forms.events.ExpansionEvent; -import org.eclipse.ui.forms.widgets.ExpandableComposite; -import org.eclipse.ui.forms.widgets.FormToolkit; - -/** - * @author Frank Becker - */ -public class BugzillaTaskAttachmentPage extends TaskAttachmentPage { - - private final List<BugzillaFlag> flagAttributes = new ArrayList<BugzillaFlag>(); - - private final FormToolkit toolkit; - - private ExpandableComposite flagExpandComposite = null; - - private Composite scrollComposite; - - public BugzillaTaskAttachmentPage(TaskAttachmentModel model) { - super(model); - toolkit = new FormToolkit(Display.getCurrent()); - } - - @Override - public void createControl(Composite parent) { - super.createControl(parent); - RepositoryConfiguration configuration = BugzillaCorePlugin.getRepositoryConfiguration(getModel().getTaskRepository() - .getRepositoryUrl()); - if (configuration != null) { - List<BugzillaFlag> flags = configuration.getFlags(); - TaskAttribute productAttribute = getModel().getAttribute().getTaskData().getRoot().getMappedAttribute( - BugzillaAttribute.PRODUCT.getKey()); - TaskAttribute componentAttribute = getModel().getAttribute().getTaskData().getRoot().getMappedAttribute( - BugzillaAttribute.COMPONENT.getKey()); - Control[] children = parent.getChildren(); - Composite pageComposite = (Composite) children[children.length - 1]; - Composite flagComposite = null; - for (BugzillaFlag bugzillaFlag : flags) { - if (bugzillaFlag.getType().equals("bug")) { //$NON-NLS-1$ - continue; - } - if (!bugzillaFlag.isUsedIn(productAttribute.getValue(), componentAttribute.getValue())) { - continue; - } - - if (flagComposite == null) { - flagComposite = createFlagSection(pageComposite); - } - BugzillaFlagMapper mapper = new BugzillaFlagMapper(); - mapper.setRequestee(""); //$NON-NLS-1$ - mapper.setSetter(""); //$NON-NLS-1$ - mapper.setState(" "); //$NON-NLS-1$ - mapper.setFlagId(bugzillaFlag.getName()); - mapper.setNumber(0); - final TaskAttribute attribute = getModel().getAttribute().createAttribute( - "task.common.kind.flag_type" + bugzillaFlag.getFlagId()); //$NON-NLS-1$ - mapper.applyTo(attribute); - - Label flagLiteral = new Label(flagComposite, SWT.NONE); - flagLiteral.setText("" + bugzillaFlag.getName()); //$NON-NLS-1$ - flagLiteral.setToolTipText(bugzillaFlag.getDescription()); - flagAttributes.add(bugzillaFlag); - final Combo flagState = new Combo(flagComposite, SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY); - flagState.add(" "); //$NON-NLS-1$ - if (bugzillaFlag.isRequestable()) { - flagState.add("?"); //$NON-NLS-1$ - } - flagState.add("+"); //$NON-NLS-1$ - flagState.add("-"); //$NON-NLS-1$ - if (bugzillaFlag.isRequestable() && bugzillaFlag.isSpecifically_requestable()) { - flagState.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 1, 1)); - final Text requesteeText = new Text(flagComposite, SWT.BORDER); - requesteeText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); - requesteeText.setEditable(false); - requesteeText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - TaskAttribute requesteeAttribute = attribute.getAttribute("requestee"); //$NON-NLS-1$ - if (requesteeAttribute != null) { - String value = requesteeText.getText().trim(); - requesteeAttribute.setValue(value); - } - } - }); - flagState.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) { - // ignore - } - - public void widgetSelected(SelectionEvent e) { - TaskAttribute state = attribute.getAttribute("state"); //$NON-NLS-1$ - if (state != null) { - String value = flagState.getItem(flagState.getSelectionIndex()); - state.setValue(value); - requesteeText.setEditable(value.equals("?")); //$NON-NLS-1$ - } - } - }); - } else { - flagState.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1)); - flagState.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) { - // ignore - } - - public void widgetSelected(SelectionEvent e) { - TaskAttribute state = attribute.getAttribute("state"); //$NON-NLS-1$ - String value = flagState.getItem(flagState.getSelectionIndex()); - if (state != null && value != null) { - state.setValue(value); - } - } - }); - } - } - } - } - - private Composite createFlagSection(Composite container) { - flagExpandComposite = toolkit.createExpandableComposite(container, ExpandableComposite.COMPACT - | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR); - flagExpandComposite.setFont(container.getFont()); - flagExpandComposite.setBackground(container.getBackground()); - flagExpandComposite.setText(Messages.BugzillaTaskAttachmentPage_flags); - flagExpandComposite.setLayout(new GridLayout(3, false)); - GridData g = new GridData(GridData.FILL_HORIZONTAL); - g.horizontalSpan = 3; - flagExpandComposite.setLayoutData(g); - flagExpandComposite.addExpansionListener(new ExpansionAdapter() { - @Override - public void expansionStateChanged(ExpansionEvent e) { - getControl().getShell().pack(); - } - }); - - scrollComposite = new Composite(flagExpandComposite, SWT.NONE); - scrollComposite.setLayout(new GridLayout(3, false)); - flagExpandComposite.setClient(scrollComposite); - return scrollComposite; - } - - @Override - public void dispose() { - if (toolkit != null) { - if (toolkit.getColors() != null) { - toolkit.dispose(); - } - } - super.dispose(); - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskListMigrator.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskListMigrator.java deleted file mode 100644 index 906634829..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskListMigrator.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.tasklist; - -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; -import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; -import org.eclipse.mylyn.tasks.core.AbstractTaskListMigrator; -import org.eclipse.mylyn.tasks.core.IRepositoryQuery; -import org.eclipse.mylyn.tasks.core.ITask; -import org.w3c.dom.Element; - -/** - * @author Rob Elves - * @since 3.0 - */ -public class BugzillaTaskListMigrator extends AbstractTaskListMigrator { - - private static final String TAG_BUGZILLA_REPORT = "BugzillaReport"; //$NON-NLS-1$ - - private static final String KEY_SEVERITY = "bugzilla.severity"; //$NON-NLS-1$ - - private static final String KEY_PRODUCT = "bugzilla.product"; //$NON-NLS-1$ - - @Override - public String getConnectorKind() { - return BugzillaCorePlugin.CONNECTOR_KIND; - } - - @Override - public Set<String> getQueryElementNames() { - Set<String> names = new HashSet<String>(); - names.add(IBugzillaConstants.TAG_BUGZILLA_QUERY); - names.add(IBugzillaConstants.TAG_BUGZILLA_CUSTOM_QUERY); - return names; - } - - @Override - public String getTaskElementName() { - return TAG_BUGZILLA_REPORT; - } - - @Override - public void migrateQuery(IRepositoryQuery query, Element element) { - if (element.getNodeName().equals(IBugzillaConstants.TAG_BUGZILLA_CUSTOM_QUERY)) { - query.setAttribute(IBugzillaConstants.ATTRIBUTE_BUGZILLA_QUERY_CUSTOM, Boolean.TRUE.toString()); - } - } - - @Override - public void migrateTask(ITask task, Element element) { - if (element.hasAttribute(KEY_SEVERITY)) { - task.setAttribute(BugzillaAttribute.BUG_SEVERITY.getKey(), - element.getAttribute(BugzillaAttribute.BUG_SEVERITY.getKey())); - } - if (element.hasAttribute(KEY_PRODUCT)) { - task.setAttribute(BugzillaAttribute.PRODUCT.getKey(), - element.getAttribute(BugzillaAttribute.PRODUCT.getKey())); - } - if (element.hasAttribute(KEY_LAST_MOD_DATE)) { - task.setAttribute(BugzillaAttribute.DELTA_TS.getKey(), element.getAttribute(KEY_LAST_MOD_DATE)); - } - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java deleted file mode 100644 index fdf774f57..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.tasklist; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.bugzilla.ui.tasklist.messages"; //$NON-NLS-1$ - - static { - // load message values from bundle file - reloadMessages(); - } - - public static void reloadMessages() { - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - public static String BugzillaConnectorUi__In_reply_to_comment_X_; - - public static String BugzillaConnectorUi__In_reply_to_X_comment_X_; - - public static String BugzillaConnectorUi__In_reply_to_comment_0_; - - public static String BugzillaCustomQueryDialog_Bugzilla_Query_Category_Name; - - public static String BugzillaCustomQueryDialog_Max_Hits_Returned__1_means_all_; - - public static String BugzillaCustomQueryDialog_Query_URL; - - public static String BugzillaCustomQueryWizardPage_Create_query_from_URL; - - public static String BugzillaCustomQueryWizardPage_Enter_the_title_and_URL_for_the_query; - - public static String BugzillaCustomQueryWizardPage_Please_specify_Query_URL; - - public static String BugzillaCustomQueryWizardPage_Query_Title; - - public static String BugzillaCustomQueryWizardPage_Query_URL; - - public static String BugzillaQueryTypeWizardPage_Choose_query_type; - - public static String BugzillaQueryTypeWizardPage_Create_query_from_existing_URL; - - public static String BugzillaQueryTypeWizardPage_Create_query_using_form; - - public static String BugzillaQueryTypeWizardPage_Select_from_the_available_query_types; - - public static String BugzillaRepositorySettingsPage_All; - - public static String BugzillaRepositorySettingsPage_AUTOTETECT_PLATFORM_AND_OS; - - public static String BugzillaRepositorySettingsPage_available_once_repository_created; - - public static String BugzillaRepositorySettingsPage_bugzilla_repository_settings; - - public static String BugzillaRepositorySettingsPage_example_do_not_include; - - public static String BugzillaRepositorySettingsPage_Language_; - - public static String BugzillaRepositorySettingsPage_local_users_enabled; - - public static String BugzillaRepositorySettingsPage_override_auto_detection_of_platform; - - public static String BugzillaRepositorySettingsPage_Retrieving_repository_configuration; - - public static String BugzillaRepositorySettingsPage_Server_URL_is_invalid; - - public static String BugzillaRepositorySettingsPage_supports_bugzilla_X; - - public static String BugzillaRepositorySettingsPage_Validating_server_settings; - - public static String BugzillaTaskAttachmentPage_flags; -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/StackTrace.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/StackTrace.java deleted file mode 100644 index 7da62a1a2..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/StackTrace.java +++ /dev/null @@ -1,373 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.tasklist; - -import java.util.ArrayList; -import java.util.List; - -/** - * Class to hold all of the information about a stack trace - * - * @author Shawn Minto - */ -public class StackTrace { - - /** The length of the stack trace in the original string */ - private final int length; - - /** The offset of the stack trace in the orignal string */ - private final int offset; - - /** The string of the stack trace */ - private final String stackTrace; - - /** - * This is the comment that the stack trace appeared in. String if desciption else Comment - */ - private final Object comment; - - /** - * Constructor - * - * @param stackTrace - * The stack trace string - * @param offset - * The offset of the stack trace in the original string - * @param length - * The length of the stack trace in the original string - * @param comment - * The comment that the stack trace came from - */ - public StackTrace(String stackTrace, int offset, int length, Object comment) { - this.stackTrace = stackTrace; - this.offset = offset; - this.length = length; - this.comment = comment; - } - - /** - * Get the offset for the stack trace - * - * @return Returns the offset. - */ - public int getOffset() { - return offset; - } - - /** - * Get the stack trace for the bug - * - * @return Returns the stackTrace. - */ - public String getStackTrace() { - return stackTrace; - } - - /** - * Get the length of the bug - * - * @return Returns the length. - */ - public int getLength() { - return length; - } - - /** - * Get the Comment that this stack trace came from - * - * @return Returns the Comment if it was a comment else a String if it was the summary - */ - public Object getComment() { - return comment; - } - - /** - * Find a standard java stack trace in the given string - * - * - * @param s - * The string to search for stack traces - * @param comment - * The comment that the text came from.<br> - * Comment if a comment else a String - * @return String[] of stack traces - each element is 1 trace - */ - public static StackTrace[] getStackTrace(String s, Object comment) { - - // setup the regex used to determine if it looks like we are at a - // stack trace and whether it is something that should be skipped - String regexExceptionType = "^(.*\\.)+.+(Exception|Error|Throwable).*"; //$NON-NLS-1$ - String regexSkip = ".*\\.\\..*"; //$NON-NLS-1$ - - // get all of the individual lines for the string - String[] lines = s.split("\r\n|\n"); //$NON-NLS-1$ - - // the character start of the current stack trace - int charStackStart = 0; - - // the current character in the string - used for the start and the - // offset - int[] charPos = { 0 }; // array so pass by reference - - boolean inStackTrace = false; - List<String> stackTrace = null; - List<StackTrace> stackTraces = new ArrayList<StackTrace>(); - - // go through each of the lines of the string - for (int i = 0; i < lines.length; i++) { - - if (lines[i].matches(regexSkip)) { - - // update the current character position - charPos[0] += lines[i].length() + 2; - - } else if (lines[i].trim().matches(regexExceptionType) && !inStackTrace) { - - // we have matched the stack trace and we are not already in one - - // add the old stack trace to the list of stack traces - if (stackTrace != null && stackTrace.size() > 1) { - stackTraces.add(getStackTrace(stackTrace, charStackStart, charPos[0] - charStackStart, comment)); - } - - // prepare for a new stack trace - stackTrace = new ArrayList<String>(); - inStackTrace = true; - - // the current line is the start of our stack trace - stackTrace.add(lines[i]); - charStackStart = charPos[0]; - charPos[0] += lines[i].length() + 2; - } else if (inStackTrace) { - // we are in a stack trace - - int[] pos = { i }; // array so pass by reference - - // get the next at clause of the stack trace - String stack = getNextAt(lines, pos, charPos); - - // check if there was an at - if (stack == null) { - - // there wasn't so we are done this stack trace - inStackTrace = false; - if (stackTrace != null && stackTrace.size() > 1) { - stackTraces.add(getStackTrace(stackTrace, charStackStart, charPos[0] - charStackStart, comment)); - } - stackTrace = null; - } else if (stackTrace != null) { - - // we had one, so add it to this stack trace - stackTrace.add(stack); - } - - // update the position - i = pos[0]; - } else { - // update the current character position - charPos[0] += lines[i].length() + 2; - } - } - - // make sure to add the stack trace if it was the last in the string - if (stackTrace != null && stackTrace.size() > 1) { - stackTraces.add(getStackTrace(stackTrace, charStackStart, charPos[0] - charStackStart, comment)); - } - - if (stackTraces.size() == 0) { - return null; - } - - // get the string values of the stack traces and return it - return getTracesFromList(stackTraces); - } - - /** - * Get the next at clause from a potential stack trace -- looks ahead 4 lines - * - * @param lines - * The array of all of the lines in the bug - * @param i - * The current position to start at - * @param charPos - * The current character position in the original string - * @return The next at clause, or <code>null</code><br> - * If an at line is matched, but the end isn't within the 4 lines, only the first line is returned. Also, - * charPos is updated as well as i - */ - private static String getNextAt(String[] lines, int[] i, int[] charPos) { - String regexAtString = "^at.*"; //$NON-NLS-1$ - String regexEndString = ".*:\\d+\\)$"; //$NON-NLS-1$ - int index = i[0]; - String l1, l2, l3, l4; - l1 = l2 = l3 = l4 = null; - String res = null; - - // get the first line to look at - if (lines.length > index) { - l1 = lines[index]; - } else { - // if the first line doesn't exist, we are done and should - // return - return null; - } - - // get the next 3 lines - if (lines.length > index + 1) { - l2 = lines[index + 1]; - } - if (lines.length > index + 2) { - l3 = lines[index + 2]; - } - if (lines.length > index + 3) { - l4 = lines[index + 3]; - } - - // make sure that the first line is the start of an at - // if not, return null - if (l1.trim().matches(regexAtString)) { - charPos[0] += l1.length() + 2; - res = l1; - } else { - return null; - } - - // now determine where the end is if it wasn't on 1 line - if (!res.trim().matches(regexEndString)) { - - if (l2 != null && l2.trim().matches(regexEndString)) { - - // it was on the second line - // update the current position and the result string - i[0] = index + 1; - charPos[0] += l2.length() + 2; - res += l2.trim(); - } else if (l2 != null && l3 != null && l3.trim().matches(regexEndString)) { - - // it was on the third line - // update the current position and the result string - i[0] = index + 2; - charPos[0] += l2.length() + l3.length() + 4; - res += l2.trim(); - res += l3.trim(); - } else if (l2 != null && l3 != null && l4 != null && l4.trim().matches(regexEndString)) { - - // it was on the fourth line - // update the current position and the result string - i[0] = index + 3; - charPos[0] += l2.length() + l3.length() + l4.length() + 6; - res += l2.trim(); - res += l3.trim(); - res += l4.trim(); - } - } - - // return the result - return res; - } - - /** - * Get the StackTrace - * - * @param l - * the list of lines that contain the trace - * @param start - * the start of the stack trace - * @param offset - * the offset of the stack trace - * @param comment - * The comment that the stack trace came from - * @return The StackTrace for the given data - */ - private static StackTrace getStackTrace(List<String> l, int offset, int length, Object comment) { - String s = ""; //$NON-NLS-1$ - for (String s2 : l) { - s += s2 + "\r\n"; //$NON-NLS-1$ - } - - return new StackTrace(s, offset, length, comment); - } - - /** - * Convert a List StackTraces to a StackTrace[] <br> - * - * @param l - * The List of StackTraces - * @return StackTrace[] of the List - */ - private static StackTrace[] getTracesFromList(List<StackTrace> l) { - - // make sure that there is something to convert, else return null - if (l == null || l.size() == 0) { - return null; - } - - // convert the list of strings to an array of strings - int i = 0; - StackTrace[] s = new StackTrace[l.size()]; - - for (StackTrace st : l) { - s[i] = st; - i++; - } - - // return the string array - return s; - } - - /** - * Escape all of the special regex characters from the string - * - * @param s - * The string to escape the characters for - * @return A string with all of the special characters escaped <br> - * <code> - * . => \.<br> - * $ => \$<br> - * ? => \?<br> - * { => \{<br> - * } => \}<br> - * ( => \(<br> - * ) => \)<br> - * [ => \[<br> - * ] => \]<br> - * + => \+<br> - * * => \*<br> - * | => \|<br> - * ^ => \^<br> - * \ => \\<br> - * / => \/<br> - * </code> - */ - public static String escapeForRegex(String s) { - String sFixed = s; - - // replace all special regex characters - sFixed = sFixed.replaceAll("\\\\", "\\\\\\\\"); //$NON-NLS-1$ //$NON-NLS-2$ - sFixed = sFixed.replaceAll("\\$", "\\\\\\$"); //$NON-NLS-1$ //$NON-NLS-2$ - sFixed = sFixed.replaceAll("\\.", "\\\\."); //$NON-NLS-1$ //$NON-NLS-2$ - sFixed = sFixed.replaceAll("\\?", "\\\\?"); //$NON-NLS-1$ //$NON-NLS-2$ - sFixed = sFixed.replaceAll("\\{", "\\\\{"); //$NON-NLS-1$ //$NON-NLS-2$ - sFixed = sFixed.replaceAll("\\}", "\\\\}"); //$NON-NLS-1$ //$NON-NLS-2$ - sFixed = sFixed.replaceAll("\\(", "\\\\("); //$NON-NLS-1$ //$NON-NLS-2$ - sFixed = sFixed.replaceAll("\\)", "\\\\)"); //$NON-NLS-1$ //$NON-NLS-2$ - sFixed = sFixed.replaceAll("\\[", "\\\\["); //$NON-NLS-1$ //$NON-NLS-2$ - sFixed = sFixed.replaceAll("\\]", "\\\\]"); //$NON-NLS-1$ //$NON-NLS-2$ - sFixed = sFixed.replaceAll("\\+", "\\\\+"); //$NON-NLS-1$ //$NON-NLS-2$ - sFixed = sFixed.replaceAll("\\*", "\\\\*"); //$NON-NLS-1$ //$NON-NLS-2$ - sFixed = sFixed.replaceAll("\\|", "\\\\|"); //$NON-NLS-1$ //$NON-NLS-2$ - sFixed = sFixed.replaceAll("\\^", "\\\\^"); //$NON-NLS-1$ //$NON-NLS-2$ - sFixed = sFixed.replaceAll("\\/", "\\\\/"); //$NON-NLS-1$ //$NON-NLS-2$ - - return sFixed; - } -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/messages.properties b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/messages.properties deleted file mode 100644 index 1a2bd94ac..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/messages.properties +++ /dev/null @@ -1,31 +0,0 @@ -BugzillaConnectorUi__In_reply_to_comment_X_=(In reply to comment \#{0}) -BugzillaConnectorUi__In_reply_to_X_comment_X_=(In reply to {0} comment \#{1}) -BugzillaConnectorUi__In_reply_to_comment_0_=(In reply to comment \#0) -BugzillaCustomQueryDialog_Bugzilla_Query_Category_Name=Bugzilla Query Category Name -BugzillaCustomQueryDialog_Max_Hits_Returned__1_means_all_=Max Hits Returned (-1 means all) -BugzillaCustomQueryDialog_Query_URL=Query URL - -BugzillaCustomQueryWizardPage_Create_query_from_URL=Create query from URL -BugzillaCustomQueryWizardPage_Enter_the_title_and_URL_for_the_query=Enter the title and URL for the query -BugzillaCustomQueryWizardPage_Please_specify_Query_URL=Please specify Query URL -BugzillaCustomQueryWizardPage_Query_Title=&Query Title: -BugzillaCustomQueryWizardPage_Query_URL=Query &URL - -BugzillaQueryTypeWizardPage_Choose_query_type=Choose query type -BugzillaQueryTypeWizardPage_Create_query_from_existing_URL=&Create query from existing URL -BugzillaQueryTypeWizardPage_Create_query_using_form=Cre&ate query using form -BugzillaQueryTypeWizardPage_Select_from_the_available_query_types=Select from the available query types. - -BugzillaRepositorySettingsPage_All=All -BugzillaRepositorySettingsPage_AUTOTETECT_PLATFORM_AND_OS=Autodetect platform and os -BugzillaRepositorySettingsPage_available_once_repository_created=Available once repository has been created. -BugzillaRepositorySettingsPage_bugzilla_repository_settings=Bugzilla Repository Settings -BugzillaRepositorySettingsPage_example_do_not_include=\nExample: https://bugs.eclipse.org/bugs (do not include index.cgi) -BugzillaRepositorySettingsPage_Language_=Language: -BugzillaRepositorySettingsPage_local_users_enabled=Local users enabled: -BugzillaRepositorySettingsPage_override_auto_detection_of_platform=Override auto detection of Platform and OS for new bug reports. -BugzillaRepositorySettingsPage_Retrieving_repository_configuration=Retrieving repository configuration -BugzillaRepositorySettingsPage_Server_URL_is_invalid=Server URL is invalid. -BugzillaRepositorySettingsPage_supports_bugzilla_X=Supports Bugzilla {0} -BugzillaRepositorySettingsPage_Validating_server_settings=Validating server settings -BugzillaTaskAttachmentPage_flags=Flags diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/Messages.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/Messages.java deleted file mode 100644 index 971007644..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/Messages.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.wizard; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.bugzilla.ui.wizard.messages"; //$NON-NLS-1$ - - static { - // load message values from bundle file - reloadMessages(); - } - - public static void reloadMessages() { - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - public static String BugzillaProductPage_Bugzilla_Search_Page; - public static String BugzillaProductPage_Error_reported; - public static String BugzillaProductPage_Error_updating_product_list; - public static String BugzillaProductPage_New_Bugzilla_Task_Error; - public static String BugzillaProductPage_PAGE_1; - public static String BugzillaProductPage_PICK_PRODUCT_TO_OPEN_NEW_BUG_EDITOR; - public static String BugzillaProductPage_PRESS_UPDATE_BUTTON; - public static String BugzillaProductPage_Unable_to_get_configuration; - public static String BugzillaProductPage_Unable_to_get_products; - public static String BugzillaProductPage_Update_Products_from_Repository; - public static String BugzillaProductPage_Updating_repository_report_options_; - public static String BugzillaProductPage_YOU_MUST_SELECT_PRODUCT; -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaTaskWizard.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaTaskWizard.java deleted file mode 100644 index 1b8e28212..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaTaskWizard.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.wizard; - -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.ArrayList; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; -import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; -import org.eclipse.mylyn.tasks.core.IRepositoryQuery; -import org.eclipse.mylyn.tasks.core.ITask; -import org.eclipse.mylyn.tasks.core.ITaskMapping; -import org.eclipse.mylyn.tasks.core.TaskMapping; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.ui.wizards.NewTaskWizard; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * @author Mik Kersten - * @author Rob Elves - */ -public class NewBugzillaTaskWizard extends NewTaskWizard implements INewWizard { - - private IStructuredSelection selection; - - public NewBugzillaTaskWizard(TaskRepository taskRepository, ITaskMapping taskSelection) { - super(taskRepository, taskSelection); - } - - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - } - - /** - * @since 3.0 - */ - @Override - protected ITaskMapping getInitializationData() { - if (getTaskSelection() != null) { - return getTaskSelection(); - } - - IWorkbench workbench = PlatformUI.getWorkbench(); - if (workbench != null) { - IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - if (window != null) { - ISelection sel = window.getSelectionService().getSelection(); - if (sel instanceof IStructuredSelection) { - selection = (IStructuredSelection) sel; - } - } - } - if (selection == null || selection.isEmpty()) { - final String lastSelection = getTaskRepository().getProperty(IBugzillaConstants.LAST_PRODUCT_SELECTION); - return new TaskMapping() { - @Override - public String getProduct() { - return lastSelection; - } - }; - - } - - final ArrayList<String> products = new ArrayList<String>(); - - Object element = (selection).getFirstElement(); - if (element instanceof ITask) { - ITask bugzillaTask = (ITask) element; - if (bugzillaTask.getAttribute(BugzillaAttribute.PRODUCT.getKey()) != null) { - products.add(bugzillaTask.getAttribute(BugzillaAttribute.PRODUCT.getKey())); - } - } else { - IRepositoryQuery query = null; - if (element instanceof IRepositoryQuery) { - query = (IRepositoryQuery) element; - } - - if (query != null && query.getConnectorKind().equals(BugzillaCorePlugin.CONNECTOR_KIND)) { - String queryUrl = query.getUrl(); - queryUrl = queryUrl.substring(queryUrl.indexOf("?") + 1); //$NON-NLS-1$ - String[] options = queryUrl.split("&"); //$NON-NLS-1$ - - for (String option : options) { - int index = option.indexOf("="); //$NON-NLS-1$ - if (index != -1) { - String key = option.substring(0, index); - if ("product".equals(key)) { //$NON-NLS-1$ - try { - products.add(URLDecoder.decode(option.substring(index + 1), - getTaskRepository().getCharacterEncoding())); - // TODO: list box only accepts a single selection so - // we break on first found - break; - } catch (UnsupportedEncodingException ex) { - // ignore - } - } - } - } - } else { - if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - ITask task = (ITask) adaptable.getAdapter(ITask.class); - if (task != null) { - ITask bugzillaTask = (ITask) element; - if (bugzillaTask.getAttribute(BugzillaAttribute.PRODUCT.getKey()) != null) { - products.add(bugzillaTask.getAttribute(BugzillaAttribute.PRODUCT.getKey())); - } - } - } - } - } - - if (products.size() > 0) { - return new TaskMapping() { - @Override - public String getProduct() { - return products.get(0); - } - }; - } - return null; - } - -} diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/messages.properties b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/messages.properties deleted file mode 100644 index 078235251..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/messages.properties +++ /dev/null @@ -1,12 +0,0 @@ -BugzillaProductPage_Bugzilla_Search_Page=Bugzilla Search Page -BugzillaProductPage_Error_reported=Error reported:\n -BugzillaProductPage_Error_updating_product_list=Error updating product list -BugzillaProductPage_New_Bugzilla_Task_Error=New Bugzilla Task Error -BugzillaProductPage_PAGE_1=Page1 -BugzillaProductPage_PICK_PRODUCT_TO_OPEN_NEW_BUG_EDITOR=Pick a product to open the new bug editor.\n -BugzillaProductPage_PRESS_UPDATE_BUTTON=Press the Update button if the product is not in the list. -BugzillaProductPage_Unable_to_get_configuration=Unable to get configuration. Ensure proper repository configuration in Task Repositories -BugzillaProductPage_Unable_to_get_products=Unable to get products. Ensure proper repository configuration in task Repositories. -BugzillaProductPage_Update_Products_from_Repository=Update Products from Repository -BugzillaProductPage_Updating_repository_report_options_=Updating repository report options... -BugzillaProductPage_YOU_MUST_SELECT_PRODUCT=You must select a product |