Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 160432 Details for
Bug 287899
consume CheckBoxTreeDialog for KeywordsDialog
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
commited patch
287899.txt (text/plain), 10.50 KB, created by
Frank Becker
on 2010-02-28 15:54:01 EST
(
hide
)
Description:
commited patch
Filename:
MIME Type:
Creator:
Frank Becker
Created:
2010-02-28 15:54:01 EST
Size:
10.50 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.bugzilla.ui >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/editor/KeywordsDialog.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/bugzilla/ui/editor/KeywordsDialog.java >diff -N src/org/eclipse/mylyn/internal/bugzilla/ui/editor/KeywordsDialog.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/editor/KeywordsDialog.java 24 Jul 2009 12:08:07 -0000 1.8 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,160 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004, 2009 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; >- } >- >-} >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java,v >retrieving revision 1.10 >diff -u -r1.10 Messages.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java 9 Jan 2010 21:07:53 -0000 1.10 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java 28 Feb 2010 20:50:12 -0000 >@@ -54,6 +54,4 @@ > public static String BugzillaVotesEditor_Show_votes; > > public static String BugzillaVotesEditor_Vote; >- >- public static String KeywordsDialog_Select_Keywords; > } >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties,v >retrieving revision 1.10 >diff -u -r1.10 messages.properties >--- src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties 9 Jan 2010 21:07:53 -0000 1.10 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties 28 Feb 2010 20:50:12 -0000 >@@ -26,5 +26,3 @@ > > BugzillaVotesEditor_Show_votes=Show votes > BugzillaVotesEditor_Vote=Vote >- >-KeywordsDialog_Select_Keywords=Select Keywords >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java,v >retrieving revision 1.136 >diff -u -r1.136 BugzillaSearchPage.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java 26 Feb 2010 20:12:59 -0000 1.136 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java 28 Feb 2010 20:50:12 -0000 >@@ -19,6 +19,10 @@ > import java.text.MessageFormat; > import java.util.ArrayList; > import java.util.Arrays; >+import java.util.HashMap; >+import java.util.HashSet; >+import java.util.Map; >+import java.util.Set; > > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IProgressMonitor; >@@ -44,7 +48,11 @@ > 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.provisional.commons.ui.WorkbenchUtil; >+import org.eclipse.mylyn.internal.provisional.commons.ui.dialogs.AbstractInPlaceDialog; >+import org.eclipse.mylyn.internal.provisional.commons.ui.dialogs.IInPlaceDialogListener; >+import org.eclipse.mylyn.internal.provisional.commons.ui.dialogs.InPlaceCheckBoxTreeDialog; >+import org.eclipse.mylyn.internal.provisional.commons.ui.dialogs.InPlaceDialogEvent; > import org.eclipse.mylyn.internal.tasks.ui.util.WebBrowserDialog; > import org.eclipse.mylyn.tasks.core.IRepositoryQuery; > import org.eclipse.mylyn.tasks.core.RepositoryStatus; >@@ -372,7 +380,7 @@ > } > emailPattern2.setText(""); //$NON-NLS-1$ > keywords.setText(""); //$NON-NLS-1$ >- keywordsOperation.deselectAll(); >+ keywordsOperation.select(0); > daysText.setText(""); //$NON-NLS-1$ > } > }); >@@ -742,17 +750,45 @@ > } > }); > >- Button keywordsSelectButton = new Button(keywordsComposite, SWT.NONE); >+ final 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()); >+ >+ final java.util.List<String> values = new ArrayList<String>(); >+ for (String string : keywords.getText().split(",")) { //$NON-NLS-1$ >+ values.add(string.trim()); >+ } >+ >+ Map<String, String> validValues = new HashMap<String, String>(); >+ for (String string : repositoryConfiguration.getKeywords()) { >+ validValues.put(string, string); >+ } >+ final InPlaceCheckBoxTreeDialog selectionDialog = new InPlaceCheckBoxTreeDialog( >+ WorkbenchUtil.getShell(), keywordsSelectButton, values, validValues, ""); //$NON-NLS-1$ >+ selectionDialog.addEventListener(new IInPlaceDialogListener() { >+ >+ public void buttonPressed(InPlaceDialogEvent event) { >+ if (event.getReturnCode() == Window.OK) { >+ Set<String> newValues = selectionDialog.getSelectedValues(); >+ if (!new HashSet<String>(values).equals(newValues)) { >+ String erg = ""; //$NON-NLS-1$ >+ for (String string : newValues) { >+ if (erg.equals("")) { //$NON-NLS-1$ >+ erg = string; >+ } else { >+ erg += (", " + string); //$NON-NLS-1$ >+ } >+ } >+ keywords.setText(erg); >+ } >+ } else if (event.getReturnCode() == AbstractInPlaceDialog.ID_CLEAR) { >+ keywords.setText(""); //$NON-NLS-1$ >+ } > } >- } >+ }); >+ selectionDialog.open(); >+ > } > }); > keywordsSelectButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 287899
: 160432 |
160433