diff options
author | Dani Megert | 2012-03-29 16:03:40 +0000 |
---|---|---|
committer | Dani Megert | 2012-03-29 16:03:40 +0000 |
commit | 991951ce1916a3c4a1bab80bbc2df6fd894c1316 (patch) | |
tree | 4fa79808c3b81bb1ce3ffa6f0687975b8879696f | |
parent | a0a4c8bf2afefe9eebf6a652367b14d6360e5f87 (diff) | |
download | eclipse.platform.text-991951ce1916a3c4a1bab80bbc2df6fd894c1316.tar.gz eclipse.platform.text-991951ce1916a3c4a1bab80bbc2df6fd894c1316.tar.xz eclipse.platform.text-991951ce1916a3c4a1bab80bbc2df6fd894c1316.zip |
Fixed bug 375468: [preferences] Focus rectangle partially obscured forv20120329-1603I20120410-0320I20120410-0304I20120410-0252I20120410-0238I20120410-0216I20120410-0152I20120410-0136I20120410-0122I20120410-0102I20120410-0049I20120410-0027I20120409-2358I20120409-2119I20120409-2018I20120409-1957I20120409-1911I20120409-1708I20120409-1622I20120409-1353I20120409-0926I20120409-0904I20120409-0315I20120409-0131I20120408-2304I20120408-2000I20120408-1521I20120408-1324I20120408-1214I20120408-1110I20120408-0330I20120408-0246I20120408-0231I20120408-0216I20120408-0152I20120408-0036I20120408-0012I20120407-2339I20120407-2245I20120407-2106I20120407-1941I20120407-1904I20120407-1840I20120407-1826I20120407-1732I20120407-1717I20120407-1631I20120407-0358I20120407-0346I20120407-0329I20120407-0305I20120407-0217I20120407-0205I20120407-0138I20120407-0103I20120407-0040I20120407-0024I20120406-2327I20120406-0935I20120406-0915I20120406-0250I20120406-0231I20120406-0006I20120405-2131I20120405-1735I20120405-1114I20120405-0114I20120404-2228I20120404-2006I20120404-1351I20120404-0051I20120403-2231
checkboxes with links
3 files changed, 16 insertions, 55 deletions
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java index aac9081f79e..42e57c619af 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java @@ -19,17 +19,11 @@ import java.util.Map; import java.util.Set; import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleAdapter; -import org.eclipse.swt.accessibility.AccessibleEvent; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.events.TraverseEvent; -import org.eclipse.swt.events.TraverseListener; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -48,7 +42,6 @@ import org.eclipse.swt.widgets.Text; import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.action.LegacyActionTools; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.DialogPage; import org.eclipse.jface.dialogs.IDialogConstants; @@ -60,7 +53,6 @@ import org.eclipse.jface.preference.PreferenceConverter; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.resource.StringConverter; -import org.eclipse.jface.util.Util; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; @@ -848,8 +840,9 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements addCheckBox(appearanceComposite, showMagnet, new BooleanDomain(), 0); label= TextEditorMessages.TextEditorDefaultsPreferencePage_showWhitespaceCharacters; + String linkText= TextEditorMessages.TextEditorDefaultsPreferencePage_showWhitespaceCharactersLinkText; Preference showWhitespaceCharacters= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_WHITESPACE_CHARACTERS, label, null); - addCheckBoxWithLink(appearanceComposite, showWhitespaceCharacters, new BooleanDomain(), 0, new SelectionAdapter() { + addCheckBoxWithLink(appearanceComposite, showWhitespaceCharacters, linkText, new BooleanDomain(), 0, new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Dialog dialog= new WhitespaceCharacterPainterOptionsDialog(Display.getDefault().getActiveShell(), fOverlayStore); dialog.open(); @@ -1137,7 +1130,7 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements return checkBox; } - Button addCheckBoxWithLink(Composite parent, final Preference preference, final Domain domain, int indentation, final SelectionListener listener) { + private Button addCheckBoxWithLink(Composite parent, final Preference preference, String linkText, final Domain domain, int indentation, final SelectionListener listener) { GridData gd= new GridData(GridData.FILL, GridData.FILL, true, false); gd.horizontalSpan= 3; gd.horizontalIndent= indentation; @@ -1153,63 +1146,29 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements final Button checkBox= new Button(composite, SWT.CHECK); checkBox.setFont(JFaceResources.getDialogFont()); + checkBox.setText(preference.getName()); gd= new GridData(GridData.FILL, GridData.CENTER, false, false); - int offset= Util.isMac() ? -4 : Util.isLinux() ? -2 : /* Windows et al. */ 3; - gd.widthHint= checkBox.computeSize(SWT.DEFAULT, SWT.DEFAULT).x + offset; checkBox.setLayoutData(gd); checkBox.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { checkboxControlChanged(preference, domain, checkBox); } }); - checkBox.getAccessible().addAccessibleListener(new AccessibleAdapter() { - public void getName(AccessibleEvent e) { - e.result= LegacyActionTools.removeMnemonics(preference.getName().replaceAll("</?[aA][^>]*>", "")); //$NON-NLS-1$ //$NON-NLS-2$ - } - }); gd= new GridData(GridData.FILL, GridData.CENTER, false, false); - Link link= new Link(composite, SWT.NONE); - link.setText(preference.getName()); + link.setText(linkText); link.setLayoutData(gd); - - // toggle checkbox when user clicks unlinked text in link: - final boolean[] linkSelected= { false }; - link.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - linkSelected[0]= true; - if (listener != null) { + if (listener != null) { + link.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { listener.widgetSelected(e); } - } - }); - link.addMouseListener(new MouseAdapter() { - public void mouseDown(MouseEvent e) { - linkSelected[0]= false; - } - public void mouseUp(MouseEvent e) { - if (!linkSelected[0]) { - checkBox.setSelection(!checkBox.getSelection()); - checkBox.setFocus(); - linkSelected[0]= false; - checkboxControlChanged(preference, domain, checkBox); - } - } - }); - link.addTraverseListener(new TraverseListener() { - public void keyTraversed(TraverseEvent e) { - if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit == true) { - e.detail= SWT.TRAVERSE_NONE; - checkBox.setSelection(!checkBox.getSelection()); - checkBox.setFocus(); - linkSelected[0]= false; - checkboxControlChanged(preference, domain, checkBox); - } - } - }); + }); + } fInitializers.add(fInitializerFactory.create(preference, checkBox)); + return checkBox; } diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java index 2110f278a39..b8dc451b5d9 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 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 @@ -141,6 +141,7 @@ final class TextEditorMessages extends NLS { public static String TextEditorDefaultsPreferencePage_smartHomeEnd; public static String TextEditorDefaultsPreferencePage_warn_if_derived; public static String TextEditorDefaultsPreferencePage_showWhitespaceCharacters; + public static String TextEditorDefaultsPreferencePage_showWhitespaceCharactersLinkText; public static String TextEditorDefaultsPreferencePage_showWhitespaceCharactersDialogInvalidInput; public static String TextEditorDefaultsPreferencePage_showWhitespaceCharactersDialogTitle; public static String TextEditorDefaultsPreferencePage_space; diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties index 2d2eba92c28..3fe2520a398 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2011 IBM Corporation and others. +# Copyright (c) 2000, 2012 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 @@ -45,7 +45,8 @@ TextEditorDefaultsPreferencePage_lineFeed=Line Feed ( \u00b6 ) TextEditorDefaultsPreferencePage_range_indicator=Show &range indicator TextEditorDefaultsPreferencePage_warn_if_derived= War&n before editing a derived file TextEditorDefaultsPreferencePage_smartHomeEnd= &Smart caret positioning at line start and end -TextEditorDefaultsPreferencePage_showWhitespaceCharacters= Sh&ow <a>whitespace characters</a> +TextEditorDefaultsPreferencePage_showWhitespaceCharacters= Sh&ow whitespace characters +TextEditorDefaultsPreferencePage_showWhitespaceCharactersLinkText= (<a>configure visibility</a>) TextEditorDefaultsPreferencePage_showWhitespaceCharactersDialogInvalidInput=''{0}'' is not a valid input. TextEditorDefaultsPreferencePage_showWhitespaceCharactersDialogTitle=Show Whitespace Characters TextEditorDefaultsPreferencePage_space=Space ( \u00b7 ) |