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 146499 Details for
Bug 275018
[Markers] Problems View / Configure Contents dialog should support rename
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Patch v01
patch_275018_1.1.txt (text/plain), 7.55 KB, created by
Hitesh
on 2009-09-04 09:43:15 EDT
(
hide
)
Description:
Patch v01
Filename:
MIME Type:
Creator:
Hitesh
Created:
2009-09-04 09:43:15 EDT
Size:
7.55 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.ide >Index: src/org/eclipse/ui/internal/views/markers/FiltersConfigurationDialog.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/FiltersConfigurationDialog.java,v >retrieving revision 1.13 >diff -u -r1.13 FiltersConfigurationDialog.java >--- src/org/eclipse/ui/internal/views/markers/FiltersConfigurationDialog.java 24 Aug 2009 14:32:04 -0000 1.13 >+++ src/org/eclipse/ui/internal/views/markers/FiltersConfigurationDialog.java 4 Sep 2009 13:00:15 -0000 >@@ -85,6 +85,8 @@ > > private Button removeButton; > >+ private Button renameButton; >+ > private Button cloneButton; > > private Button andButton; >@@ -92,6 +94,7 @@ > private Button orButton; > > private Label andOrLabel; >+ > /** > * Create a new instance of the receiver on builder. > * >@@ -253,6 +256,7 @@ > > filtersList = CheckboxTableViewer.newCheckList(filtersComposite, > SWT.BORDER); >+ > filtersList.setContentProvider(new IStructuredContentProvider() { > /* > * (non-Javadoc) >@@ -360,7 +364,17 @@ > } > }); > setButtonLayoutData(removeButton); >- >+ >+ renameButton = new Button(buttons, SWT.PUSH); >+ renameButton.setText(MarkerMessages.MarkerFilter_renameName); >+ renameButton.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ MarkerFieldFilterGroup filterGroup = (MarkerFieldFilterGroup) ((IStructuredSelection) filtersList >+ .getSelection()).getFirstElement(); >+ renameFilter(filterGroup); >+ } >+ }); >+ setButtonLayoutData(renameButton); > > andOrLabel = new Label(filtersComposite, SWT.NONE); > GridData labelData = new GridData(); >@@ -420,34 +434,62 @@ > * > */ > private void addNewFilter(boolean cloneSelected) { >+ String newName =getNewFilterName(getCurrentFilterNames(),null); >+ if (newName != null) { >+ createNewFilter(newName,cloneSelected); >+ } >+ } >+ /** >+ * Opens Input Dialog for a new filter name >+ * @param avoidNames filter names to avoid >+ * @param initialName initial name of the filter >+ * @return new filter name or null if canceled >+ * >+ */ >+ private String getNewFilterName(final Collection avoidNames,String initialName){ > InputDialog newDialog = new InputDialog(getShell(), > MarkerMessages.MarkerFilterDialog_title, > MarkerMessages.MarkerFilterDialog_message, >- MarkerMessages.MarkerFilter_newFilterName, >- new IInputValidator() { >- public String isValid(String newText) { >- if (newText.length() == 0) >- return MarkerMessages.MarkerFilterDialog_emptyMessage; >- Iterator filterIterator = filterGroups >- .iterator(); >- while (filterIterator.hasNext()) { >- if (((MarkerFieldFilterGroup) filterIterator >- .next()).getName().equals(newText)) >- return NLS >- .bind( >- MarkerMessages.filtersDialog_conflictingName, >- newText); >- } >- >- return null; >- } >- }); >+ initialName != null ? initialName >+ : MarkerMessages.MarkerFilter_newFilterName, >+ getNameValidator(avoidNames)); > if (Window.OK == newDialog.open()) { >- String newName = newDialog.getValue(); >- if (newName != null) { >- createNewFilter(newName,cloneSelected); >+ return newDialog.getValue(); >+ } >+ return null; >+ } >+ >+ /** >+ * Get IInputValidator for checking if the new name is valid >+ * @param avoidNames >+ * @return IInputValidator >+ */ >+ private IInputValidator getNameValidator(final Collection avoidNames) { >+ return new IInputValidator() { >+ public String isValid(String value) { >+ String newText=value.trim(); >+ if (newText.length() == 0) >+ return MarkerMessages.MarkerFilterDialog_emptyMessage; >+ if (avoidNames.contains(newText)) >+ return NLS.bind( >+ MarkerMessages.filtersDialog_conflictingName, >+ newText); >+ return null; > } >+ }; >+ } >+ >+ /** >+ * Get a collection of names of the filters currently in the list >+ * @return Collection >+ */ >+ private Collection getCurrentFilterNames() { >+ Collection names = new ArrayList(); >+ Iterator filterIterator = filterGroups.iterator(); >+ while (filterIterator.hasNext()) { >+ names.add(((MarkerFieldFilterGroup) filterIterator.next()).getName()); > } >+ return names; > } > /** > * Create a new filterGroup, and adds it to the filterGroups >@@ -468,6 +510,23 @@ > } > > /** >+ * Renames the supplied MarkerFieldFilterGroup >+ * @param filterGroup >+ */ >+ private void renameFilter(MarkerFieldFilterGroup filterGroup) { >+ if (filterGroup != null) { >+ Collection names = getCurrentFilterNames(); >+ String initial = null; >+ initial = filterGroup.getName(); >+ names.remove(initial); >+ String newName=getNewFilterName(names, initial); >+ if(newName!=null){ >+ filterGroup.setName(newName); >+ filtersList.update(filterGroup, null); >+ } >+ } >+ } >+ /** > * Enable/disable 'and', 'or' buttons > */ > private void updateAndOrEnblement() { >@@ -689,10 +748,15 @@ > * @param markerFieldFilterGroup > */ > private void setSelectedFilter(MarkerFieldFilterGroup markerFieldFilterGroup) { >- >+ if(selectedFilterGroup==markerFieldFilterGroup){ >+ return; >+ } > removeButton > .setEnabled(!(markerFieldFilterGroup == null || markerFieldFilterGroup > .isSystem())); >+ renameButton >+ .setEnabled(!(markerFieldFilterGroup == null || markerFieldFilterGroup >+ .isSystem())); > cloneButton.setEnabled(markerFieldFilterGroup != null); > > MarkerFieldFilterGroup old = selectedFilterGroup; >Index: src/org/eclipse/ui/views/markers/internal/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/views/markers/internal/messages.properties,v >retrieving revision 1.90 >diff -u -r1.90 messages.properties >--- src/org/eclipse/ui/views/markers/internal/messages.properties 2 Sep 2009 17:12:17 -0000 1.90 >+++ src/org/eclipse/ui/views/markers/internal/messages.properties 4 Sep 2009 13:00:15 -0000 >@@ -180,11 +180,12 @@ > MarkerFilter_addFilterName=&New... > MarkerFilter_cloneFilterName=D&uplicate... > MarkerFilter_deleteSelectedName = Remo&ve >+MarkerFilter_renameName = &Rename > MarkerFilter_showAllCommand_title = &Show All > MarkerFilter_ConfigureContentsCommand_title = &Configure Contents... > >-MarkerFilterDialog_title=Add New Filter >-MarkerFilterDialog_message=Select Filter Name >+MarkerFilterDialog_title=Filter Name >+MarkerFilterDialog_message=Select a filter name > MarkerFilterDialog_emptyMessage=Name must not be empty > AND_OR_Label=Show results matching: > AND_Title = A&ll enabled filters >Index: src/org/eclipse/ui/views/markers/internal/MarkerMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/views/markers/internal/MarkerMessages.java,v >retrieving revision 1.67 >diff -u -r1.67 MarkerMessages.java >--- src/org/eclipse/ui/views/markers/internal/MarkerMessages.java 2 Sep 2009 17:12:17 -0000 1.67 >+++ src/org/eclipse/ui/views/markers/internal/MarkerMessages.java 4 Sep 2009 13:00:15 -0000 >@@ -199,6 +199,7 @@ > public static String MarkerFilter_addFilterName; > public static String MarkerFilter_cloneFilterName; > public static String MarkerFilter_deleteSelectedName; >+ public static String MarkerFilter_renameName; > public static String MarkerFilter_showAllCommand_title; > public static String MarkerFilter_ConfigureContentsCommand_title; >
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 Raw
Actions:
View
Attachments on
bug 275018
: 146499