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 65134 Details for
Bug 176235
[Contributions] polish new keys preference page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
NewKeyPreferencePage v-08
NewKeysPreferencePage v-08.txt (text/plain), 12.62 KB, created by
ali sheraz
on 2007-04-26 21:28:02 EDT
(
hide
)
Description:
NewKeyPreferencePage v-08
Filename:
MIME Type:
Creator:
ali sheraz
Created:
2007-04-26 21:28:02 EDT
Size:
12.62 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferenceMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferenceMessages.java,v >retrieving revision 1.7 >diff -u -r1.7 NewKeysPreferenceMessages.java >--- Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferenceMessages.java 26 Apr 2007 18:20:56 -0000 1.7 >+++ Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferenceMessages.java 27 Apr 2007 01:26:36 -0000 >@@ -53,6 +53,10 @@ > public static String Unavailable_Category; > public static String Undefined_Context; > >+ public static String KeysPreferenceFilterDialog_Title; >+ public static String ActionSetFilterCheckBox_Text; >+ public static String InternalFilterCheckBox_Text; >+ > static { > // load message values from bundle file > NLS.initializeMessages(BUNDLE_NAME, NewKeysPreferenceMessages.class); >Index: Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.properties,v >retrieving revision 1.12 >diff -u -r1.12 NewKeysPreferencePage.properties >--- Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.properties 26 Apr 2007 18:20:56 -0000 1.12 >+++ Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.properties 27 Apr 2007 01:26:36 -0000 >@@ -41,3 +41,7 @@ > > Undefined_Context=Undefined Context > >+ActionSetFilterCheckBox_Text= Filter ActionSet Contexts >+InternalFilterCheckBox_Text = Filter Internal Contexts >+KeysPreferenceFilterDialog_Title= When Combo Filters >+ >Index: Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.java,v >retrieving revision 1.38 >diff -u -r1.38 NewKeysPreferencePage.java >--- Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.java 26 Apr 2007 18:20:56 -0000 1.38 >+++ Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.java 27 Apr 2007 01:26:36 -0000 >@@ -19,6 +19,7 @@ > import java.util.HashMap; > import java.util.HashSet; > import java.util.Iterator; >+import java.util.List; > import java.util.Map; > import java.util.Set; > >@@ -41,6 +42,7 @@ > import org.eclipse.jface.bindings.keys.KeySequenceText; > import org.eclipse.jface.bindings.keys.KeyStroke; > import org.eclipse.jface.contexts.IContextIds; >+import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.jface.dialogs.IDialogConstants; > import org.eclipse.jface.dialogs.IDialogSettings; > import org.eclipse.jface.dialogs.MessageDialog; >@@ -67,7 +69,10 @@ > import org.eclipse.jface.viewers.TreeViewer; > import org.eclipse.jface.viewers.Viewer; > import org.eclipse.jface.viewers.ViewerComparator; >+import org.eclipse.jface.window.Window; > import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.MouseEvent; >+import org.eclipse.swt.events.MouseListener; > import org.eclipse.swt.events.SelectionAdapter; > import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.graphics.Image; >@@ -664,6 +669,10 @@ > * The path at which the icon for "groups of bindings" is located. > */ > private static final String ICON_GROUP_OF_BINDINGS = "$nl$/icons/full/obj16/keygroups_obj.gif"; //$NON-NLS-1$ >+ >+ private static final String CONTEXT_ID_ACTION_SETS="org.eclipse.ui.contexts.actionSet"; //$NON-NLS-1$ >+ >+ private static final String CONTEXT_ID_INTERNAL=".internal."; //$NON-NLS-1$ > > /** > * The number of items to show in the bindings table tree. >@@ -676,7 +685,7 @@ > */ > private static final NamedHandleObjectComparator NAMED_HANDLE_OBJECT_COMPARATOR = new NamedHandleObjectComparator(); > >- private final static String TAG_DIALOG_SECTION = "org.eclipse.ui.preferences.keysPreferencePage"; //$NON-NLS-1$ >+ public final static String TAG_DIALOG_SECTION = "org.eclipse.ui.preferences.keysPreferencePage"; //$NON-NLS-1$ > > private final String TAG_FIELD = "showAllField"; //$NON-NLS-1$ > >@@ -884,7 +893,26 @@ > gridData.widthHint = Math.max(widthHint, advancedButton.computeSize( > SWT.DEFAULT, SWT.DEFAULT, true).x) + 5; > advancedButton.setLayoutData(gridData); >+ advancedButton.addMouseListener(new MouseListener(){ >+ >+ public void mouseDoubleClick(MouseEvent e) { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ public void mouseDown(MouseEvent e) { >+ // TODO Auto-generated method stub >+ >+ } > >+ public void mouseUp(MouseEvent e) { >+ // TODO Auto-generated method stub >+ >+ Dialog dialog=new KeysPreferenceFiltersDialog(getShell()); >+ if (dialog.open() == Window.OK) { >+ whenCombo.setInput(getContexts()); >+ } >+ }}); > return buttonBar; > } > >@@ -1038,6 +1066,7 @@ > whenCombo.getCombo().setLayoutData(gridData); > whenCombo.setLabelProvider(new NamedHandleObjectLabelProvider()); > whenCombo.setContentProvider(new ArrayContentProvider()); >+ whenCombo.setComparator(new ViewerComparator()); > > // RIGHT DATA AREA > // Creates the right data area. >@@ -1339,7 +1368,8 @@ > setScheme(localChangeManager.getActiveScheme()); > > // Update the when combo. >- whenCombo.setInput(sortByName(contextService.getDefinedContexts())); >+ whenCombo.setInput(getContexts()); >+ > } > > /* >@@ -1875,4 +1905,67 @@ > } > return settings; > } >+ >+ protected Object[] getContexts(){ >+ >+ Context[] contexts=contextService.getDefinedContexts(); >+ List filteredContexts=new ArrayList(); >+ boolean actionSetFilterchecked; >+ boolean internalFilterChecked; >+ IDialogSettings settings=getDialogSettings(); >+ if (settings.get(KeysPreferenceFiltersDialog.TAG_FILTER_ACTION_SETS)==null){ >+ //First time TAG_FILTER_ACTION_SETS will be null so we have to set actionSetFilterchecked to true >+ actionSetFilterchecked=true; >+ }else >+ actionSetFilterchecked=settings.getBoolean(KeysPreferenceFiltersDialog.TAG_FILTER_ACTION_SETS); >+ try { >+ if (actionSetFilterchecked) { >+ for (int i = 0; i < contexts.length; i++) { >+ String parentId = contexts[i].getParentId(); >+ boolean check = false; >+ if (contexts[i].getId().equalsIgnoreCase(CONTEXT_ID_ACTION_SETS)){ >+ check=true; >+ } >+ while (parentId != null) { >+ if (parentId >+ .equalsIgnoreCase(CONTEXT_ID_ACTION_SETS)) { >+ check = true; >+ } >+ parentId = contextService.getContext(parentId) >+ .getParentId(); >+ } >+ if (!check) { >+ filteredContexts.add(contexts[i]); >+ } >+ } >+ }else{ >+ //if actionSet filter is off then filteredContexts will be null so we have to copy all the contexts to it. >+ for (int i=0; i<contexts.length;i++){ >+ filteredContexts.add(contexts[i]); >+ } >+ } >+ >+ if (settings.get(KeysPreferenceFiltersDialog.TAG_FILTER_INTERNAL) == null) { >+ //First time TAG_FILTER_INTERNAL will be null so we have to set actionSetFilterchecked to true >+ internalFilterChecked = true; >+ } else >+ internalFilterChecked = settings >+ .getBoolean(KeysPreferenceFiltersDialog.TAG_FILTER_INTERNAL); >+ >+ if (internalFilterChecked) { >+ for (int i = 0; i < filteredContexts.size(); i++) { >+ if (((Context) filteredContexts.get(i)).getId().indexOf( >+ CONTEXT_ID_INTERNAL) != -1) { >+ filteredContexts.remove(i); >+ } >+ } >+ } >+ >+ } catch (NotDefinedException e) { >+ return contexts; >+ } >+ >+ >+ return filteredContexts.toArray(); >+ } > } >Index: Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferenceFiltersDialog.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferenceFiltersDialog.java >diff -N Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferenceFiltersDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferenceFiltersDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,140 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation 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: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.keys; >+ >+import org.eclipse.jface.dialogs.IDialogSettings; >+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; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.ui.internal.WorkbenchPlugin; >+import org.eclipse.ui.preferences.ViewSettingsDialog; >+ >+/** >+ * Creates a dialog box for applying filter selection of When combo box in >+ * NewKeysPreferencePage >+ * >+ * @since 3.3 >+ * >+ */ >+public class KeysPreferenceFiltersDialog extends ViewSettingsDialog { >+ >+ private Button actionSetFilterCheckBox; >+ private Button internalFilterCheckBox; >+ >+ public static final String TAG_FILTER_ACTION_SETS = "actionSetFilter"; //$NON-NLS-1$ >+ public static final String TAG_FILTER_INTERNAL = "internalFilter"; //$NON-NLS-1$ >+ >+ /** >+ * @param parentShell >+ */ >+ public KeysPreferenceFiltersDialog(Shell parentShell) { >+ super(parentShell); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.ui.preferences.ViewSettingsDialog#performDefaults() >+ */ >+ protected void performDefaults() { >+ actionSetFilterCheckBox.setSelection(true); >+ internalFilterCheckBox.setSelection(true); >+ super.performDefaults(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) >+ */ >+ protected Control createDialogArea(Composite parent) { >+ Composite topComposite = (Composite) super.createDialogArea(parent); >+ super.createDialogArea(parent); >+ GridLayout layout = new GridLayout(1, false); >+ topComposite.setLayout(layout); >+ topComposite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL)); >+ actionSetFilterCheckBox = new Button(topComposite, SWT.CHECK); >+ actionSetFilterCheckBox >+ .setText(NewKeysPreferenceMessages.ActionSetFilterCheckBox_Text); >+ internalFilterCheckBox = new Button(topComposite, SWT.CHECK); >+ internalFilterCheckBox >+ .setText(NewKeysPreferenceMessages.InternalFilterCheckBox_Text); >+ >+ IDialogSettings settings = getDialogSettings(); >+ boolean checked; >+ if (settings.get(TAG_FILTER_ACTION_SETS) == null) { >+ // Using workspace first time, TAG_FILTER_ACTION_SETS is null >+ checked = true; >+ } else >+ checked = settings.getBoolean(TAG_FILTER_ACTION_SETS); >+ actionSetFilterCheckBox.setSelection(checked); >+ >+ if (settings.get(TAG_FILTER_INTERNAL) == null) { >+ // //Using workspace first time, TAG_FILTER_INTERNAL is null >+ checked = true; >+ } else >+ checked = settings.getBoolean(TAG_FILTER_INTERNAL); >+ internalFilterCheckBox.setSelection(checked); >+ >+ return topComposite; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.dialogs.Dialog#okPressed() >+ */ >+ protected void okPressed() { >+ saveState(getDialogSettings()); >+ super.okPressed(); >+ } >+ >+ public void saveState(IDialogSettings dialogSettings) { >+ if (dialogSettings == null) { >+ return; >+ } >+ dialogSettings.put(TAG_FILTER_ACTION_SETS, actionSetFilterCheckBox >+ .getSelection()); >+ dialogSettings.put(TAG_FILTER_INTERNAL, internalFilterCheckBox >+ .getSelection()); >+ } >+ >+ protected IDialogSettings getDialogSettings() { >+ IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault() >+ .getDialogSettings(); >+ >+ IDialogSettings settings = workbenchSettings >+ .getSection(NewKeysPreferencePage.TAG_DIALOG_SECTION); >+ >+ if (settings == null) { >+ settings = workbenchSettings >+ .addNewSection(NewKeysPreferencePage.TAG_DIALOG_SECTION); >+ } >+ return settings; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) >+ */ >+ protected void configureShell(Shell newShell) { >+ super.configureShell(newShell); >+ newShell >+ .setText(NewKeysPreferenceMessages.KeysPreferenceFilterDialog_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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 176235
:
60868
|
61014
|
62303
|
62949
|
64943
|
65041
|
65081
|
65134
|
65137
|
65345