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 90699 Details for
Bug 220296
[Preferences] PreferenceLinkArea should support multiple pages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch implementing extra constructor
preferencemulitlink.patch (text/plain), 3.69 KB, created by
Nitin Dahyabhai
on 2008-02-25 17:42:36 EST
(
hide
)
Description:
patch implementing extra constructor
Filename:
MIME Type:
Creator:
Nitin Dahyabhai
Created:
2008-02-25 17:42:36 EST
Size:
3.69 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/dialogs/PreferenceLinkArea.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PreferenceLinkArea.java,v >retrieving revision 1.7 >diff -u -r1.7 PreferenceLinkArea.java >--- Eclipse UI/org/eclipse/ui/dialogs/PreferenceLinkArea.java 8 May 2006 20:55:32 -0000 1.7 >+++ Eclipse UI/org/eclipse/ui/dialogs/PreferenceLinkArea.java 25 Feb 2008 22:32:09 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2006 IBM Corporation and others. >+ * Copyright (c) 2004, 2008 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 >@@ -10,8 +10,9 @@ > *******************************************************************************/ > package org.eclipse.ui.dialogs; > >-import com.ibm.icu.text.MessageFormat; >+import java.util.ArrayList; > import java.util.Iterator; >+import java.util.List; > > import org.eclipse.jface.preference.IPreferenceNode; > import org.eclipse.jface.preference.PreferenceManager; >@@ -25,6 +26,8 @@ > import org.eclipse.ui.internal.WorkbenchMessages; > import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; > >+import com.ibm.icu.text.MessageFormat; >+ > /** > * The PreferenceLinkArea is the link area used to open a specific preference > * page. >@@ -84,7 +87,65 @@ > > } > >- /** >+ >+ /** >+ * Create a new instance of the receiver >+ * >+ * @param parent >+ * the parent Composite >+ * @param style >+ * the SWT style >+ * @param pageIds >+ * the page ids >+ * @param message >+ * the message to use as text. If this message has {<i>n</i>} in its >+ * value it will be bound with the displayed name of the <i>n</i>th >+ * preference page. This message must be well formed html if >+ * you wish to link to another page. >+ * @param pageContainer - >+ * The container another page will be opened in. >+ * @param pageData - >+ * The data to apply to the page. >+ * >+ * @since 3.4 >+ */ >+ public PreferenceLinkArea(Composite parent, int style, final String[] pageIds, >+ String message, final IWorkbenchPreferenceContainer pageContainer, >+ final Object pageData) { >+ pageLink = new Link(parent, style); >+ >+ String result = null; >+ final List pageTitles = new ArrayList(pageIds.length); >+ for (int i = 0; i < pageIds.length && result == null; i++) { >+ IPreferenceNode node = getPreferenceNode(pageIds[i]); >+ if (node == null) { >+ result = NLS.bind(WorkbenchMessages.PreferenceNode_NotFound, pageIds[i]); >+ } else { >+ pageTitles.add(node.getLabelText()); >+ } >+ } >+ if (result == null) { >+ result = MessageFormat.format(message, pageTitles.toArray()); >+ >+ // Only add the selection listener if the node is found >+ pageLink.addSelectionListener(new SelectionAdapter() { >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) >+ */ >+ public void widgetSelected(SelectionEvent e) { >+ for (int i = 0; i < pageIds.length; i++) { >+ if(pageTitles.get(i).equals(e.text)) >+ pageContainer.openPage(pageIds[i], pageData); >+ } >+ } >+ }); >+ pageLink.setText(result); >+ } >+ } >+ >+ /** > * Get the preference node with pageId. > * > * @param pageId
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 220296
: 90699