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 80703 Details for
Bug 146623
[Commands] Define command / retargetable action / keybinding for switching pages in a PageBookView
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
basic functionality of cycling pages
patch-CyclePageBook_v01.txt (text/plain), 15.00 KB, created by
Tim Mok
on 2007-10-18 17:02:44 EDT
(
hide
)
Description:
basic functionality of cycling pages
Filename:
MIME Type:
Creator:
Tim Mok
Created:
2007-10-18 17:02:44 EDT
Size:
15.00 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/part/IPageBookViewPage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPageBookViewPage.java,v >retrieving revision 1.8 >diff -u -r1.8 IPageBookViewPage.java >--- Eclipse UI/org/eclipse/ui/part/IPageBookViewPage.java 16 Mar 2007 18:00:34 -0000 1.8 >+++ Eclipse UI/org/eclipse/ui/part/IPageBookViewPage.java 18 Oct 2007 20:32:31 -0000 >@@ -41,4 +41,10 @@ > * @exception PartInitException if this page was not initialized successfully > */ > public void init(IPageSite site) throws PartInitException; >+ >+ /** >+ * Returns the page's label. >+ * @return A <code>String</code> that identifies the page. >+ */ >+ public String getLabel(); > } >Index: Eclipse UI/org/eclipse/ui/part/PageBookView.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageBookView.java,v >retrieving revision 1.36 >diff -u -r1.36 PageBookView.java >--- Eclipse UI/org/eclipse/ui/part/PageBookView.java 16 Mar 2007 18:00:34 -0000 1.36 >+++ Eclipse UI/org/eclipse/ui/part/PageBookView.java 18 Oct 2007 20:32:31 -0000 >@@ -16,6 +16,8 @@ > import java.util.Map; > import java.util.Set; > >+import org.eclipse.core.commands.Command; >+import org.eclipse.core.commands.ParameterizedCommand; > import org.eclipse.core.commands.common.EventManager; > import org.eclipse.core.runtime.Platform; > import org.eclipse.jface.action.IAction; >@@ -31,12 +33,19 @@ > import org.eclipse.swt.SWT; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Table; >+import org.eclipse.swt.widgets.TableItem; > import org.eclipse.ui.IActionBars; > import org.eclipse.ui.IPartListener; > import org.eclipse.ui.IViewSite; >+import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.PartInitException; > import org.eclipse.ui.SubActionBars; >+import org.eclipse.ui.commands.ICommandService; >+import org.eclipse.ui.internal.CycleBaseHandler; >+import org.eclipse.ui.internal.WorkbenchMessages; >+import org.eclipse.ui.internal.WorkbenchPage; > import org.eclipse.ui.internal.WorkbenchPlugin; > import org.eclipse.ui.internal.util.Util; > >@@ -170,6 +179,70 @@ > private SelectionProvider selectionProvider = new SelectionProvider(); > > /** >+ * The handler for <code>PageBookView</code> that will cycle the pages of >+ * the pagebook. >+ */ >+ public static class CyclePageBookViewHandler extends CycleBaseHandler { >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.CycleBaseHandler#activate(org.eclipse.ui.part.IPage) >+ */ >+ protected void activate(IWorkbenchPage page, Object[] selection) { >+ PageBookView pageBookView = (PageBookView) selection[0]; >+ IPage selectedPage = (IPage) selection[1]; >+ PageRec pageRec = pageBookView.getPageRec(selectedPage); >+ pageBookView.showPageRec(pageRec); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.CycleBaseHandler#addItems(org.eclipse.swt.widgets.Table, org.eclipse.ui.internal.WorkbenchPage) >+ */ >+ protected void addItems(Table table, WorkbenchPage page) { >+ PageBookView pageBookView = (PageBookView) page.getActivePart(); >+ >+ Object[] pageRecs = pageBookView.getPageRecs(); >+ for (int i = pageRecs.length - 1; i >= 0; i--) { >+ final Object[] selection = new Object[2]; >+ selection[0] = pageBookView; >+ selection[1] = ((PageRec)pageRecs[i]).page; >+ TableItem item = new TableItem(table, SWT.NONE); >+ item.setText(((IPageBookViewPage)((PageRec)pageRecs[i]).page).getLabel()); >+ item.setImage(pageBookView.getTitleImage()); >+ item.setData(selection); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.CycleBaseHandler#getBackwardCommand() >+ */ >+ protected ParameterizedCommand getBackwardCommand() { >+ final ICommandService commandService = (ICommandService) window.getWorkbench().getService(ICommandService.class); >+ final Command command = commandService.getCommand("org.eclipse.ui.navigate.previousPage"); //$NON-NLS-1$ >+ ParameterizedCommand commandBack = new ParameterizedCommand(command, null); >+ return commandBack; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.CycleBaseHandler#getForwardCommand() >+ */ >+ protected ParameterizedCommand getForwardCommand() { >+ // TODO Auto-generated method stub >+ final ICommandService commandService = (ICommandService) window.getWorkbench().getService(ICommandService.class); >+ final Command command = commandService.getCommand("org.eclipse.ui.navigate.nextPage"); //$NON-NLS-1$ >+ ParameterizedCommand commandBack = new ParameterizedCommand(command, null); >+ return commandBack; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.CycleBaseHandler#getTableHeader() >+ */ >+ protected String getTableHeader() { >+ return WorkbenchMessages.CyclePageBookAction_header; >+ } >+ >+ } >+ >+ /** > * A data structure used to store the information about a single page within > * a pagebook view. > */ >@@ -990,4 +1063,12 @@ > protected SelectionProvider getSelectionProvider() { > return selectionProvider; > } >+ >+ /** >+ * Returns the pages from the pagebook. >+ * @return an array of type <code>IPage</code> >+ */ >+ protected Object[] getPageRecs(){ >+ return mapPartToRec.values().toArray(); >+ } > } >Index: Eclipse UI/org/eclipse/ui/part/Page.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/Page.java,v >retrieving revision 1.9 >diff -u -r1.9 Page.java >--- Eclipse UI/org/eclipse/ui/part/Page.java 8 May 2006 20:55:33 -0000 1.9 >+++ Eclipse UI/org/eclipse/ui/part/Page.java 18 Oct 2007 20:32:31 -0000 >@@ -49,6 +49,7 @@ > * The site which contains this page > */ > private IPageSite site; >+ private String label; > > /* > * Creates a new page for a pagebook view. >@@ -108,6 +109,7 @@ > */ > public void init(IPageSite pageSite) { > site = pageSite; >+ label = ""; //$NON-NLS-1$ > } > > /** >@@ -124,4 +126,21 @@ > * does nothing. Subclasses must implement. > */ > public abstract void setFocus(); >+ >+ /** >+ * Returns the page's label. >+ * @return A <code>String</code> that identifies the page. >+ */ >+ public String getLabel() { >+ return label; >+ } >+ >+ /** >+ * Sets the page's label. >+ * @param label >+ * The text shown to the user that will identify this page. >+ */ >+ public void setLabel(String label) { >+ this.label = label; >+ } > } >Index: Eclipse UI/org/eclipse/ui/internal/CycleBaseHandler.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CycleBaseHandler.java,v >retrieving revision 1.1 >diff -u -r1.1 CycleBaseHandler.java >--- Eclipse UI/org/eclipse/ui/internal/CycleBaseHandler.java 17 Apr 2007 12:06:16 -0000 1.1 >+++ Eclipse UI/org/eclipse/ui/internal/CycleBaseHandler.java 18 Oct 2007 20:32:31 -0000 >@@ -104,8 +104,12 @@ > > IWorkbenchPage page = window.getActivePage(); > activePart = page.getActivePart(); >- openDialog((WorkbenchPage) page); >- activate(page, selection); >+ if (!activePart.getClass().getCanonicalName().equals("org.eclipse.ui.views.contentoutline.ContentOutline")) { //$NON-NLS-1$ >+ openDialog((WorkbenchPage) page); >+ if (selection != null) { >+ activate(page, selection); >+ } >+ } > > return null; > } >@@ -132,8 +136,8 @@ > > switch (tableItemCount) { > case 0: >- // do nothing; >- break; >+ // don't open the dialog, nothing to display >+ return; > case 1: > table.setSelection(0); > break; >@@ -381,9 +385,17 @@ > IPerspectiveDescriptor persp = (IPerspectiveDescriptor) selectedItem; > page.setPerspective(persp); > } >- >+ >+ if (selectedItem instanceof Object[]){ >+ Object[] selectedPage = (Object[]) selectedItem; >+ activate(page, selectedPage); >+ } > } > } >+ >+ protected void activate(IWorkbenchPage page, Object[] selectedPage) { >+ // default, do nothing >+ } > > /* > * Close the dialog and set selection to null. >Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java,v >retrieving revision 1.93 >diff -u -r1.93 WorkbenchMessages.java >--- Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java 2 Oct 2007 18:49:52 -0000 1.93 >+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java 18 Oct 2007 20:32:31 -0000 >@@ -238,6 +238,7 @@ > public static String CyclePerspectiveAction_prev_text; > public static String CyclePerspectiveAction_prev_toolTip; > public static String CyclePerspectiveAction_header; >+ public static String CyclePageBookAction_header; > public static String ActivateEditorAction_text; > public static String ActivateEditorAction_toolTip; > public static String MaximizePartAction_text; >Index: Eclipse UI/org/eclipse/ui/internal/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties,v >retrieving revision 1.363 >diff -u -r1.363 messages.properties >--- Eclipse UI/org/eclipse/ui/internal/messages.properties 2 Oct 2007 18:49:52 -0000 1.363 >+++ Eclipse UI/org/eclipse/ui/internal/messages.properties 18 Oct 2007 20:32:31 -0000 >@@ -197,6 +197,7 @@ > CyclePerspectiveAction_prev_text = Previo&us Perspective > CyclePerspectiveAction_prev_toolTip = Previous Perspective > CyclePerspectiveAction_header=Perspectives >+CyclePageBookAction_header= Pages > ActivateEditorAction_text = &Activate Editor > ActivateEditorAction_toolTip = Activate Editor > MaximizePartAction_text = Ma&ximize Active View or Editor >#P org.eclipse.ui.console >Index: src/org/eclipse/ui/console/TextConsolePage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java,v >retrieving revision 1.26 >diff -u -r1.26 TextConsolePage.java >--- src/org/eclipse/ui/console/TextConsolePage.java 27 Mar 2007 01:39:13 -0000 1.26 >+++ src/org/eclipse/ui/console/TextConsolePage.java 18 Oct 2007 20:32:32 -0000 >@@ -398,4 +398,8 @@ > public void setViewer(TextConsoleViewer viewer) { > this.fViewer = viewer; > } >+ >+ public String getLabel() { >+ return fConsole.getName(); >+ } > } >#P org.eclipse.ui >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui/plugin.properties,v >retrieving revision 1.196 >diff -u -r1.196 plugin.properties >--- plugin.properties 2 Oct 2007 18:49:57 -0000 1.196 >+++ plugin.properties 18 Oct 2007 20:32:33 -0000 >@@ -174,6 +174,9 @@ > command.next.name = Next > command.nextEditor.description = Switch to the next editor > command.nextEditor.name = Next Editor >+command.nextPage.name = Next Page >+command.next.navigationPageParameter.name = Next Page >+command.nextPage.description = Switch to the next page > command.nextPerspective.description = Switch to the next perspective > command.nextPerspective.name = Next Perspective > command.nextView.description = Switch to the next view >@@ -189,8 +192,11 @@ > command.preferences.preferencePageIdParameter = Preference Page > command.previous.description = Navigate to the previous item > command.previous.name = Previous >+command.previous.navigationPageParameter.name = Previous Page > command.previousEditor.description = Switch to the previous editor > command.previousEditor.name = Previous Editor >+command.previousPage.description = Switch to the previous page >+command.previousPage.name = Previous Page > command.previousPerspective.description = Switch to the previous perspective > command.previousPerspective.name = Previous Perspective > command.previousView.description = Switch to the previous view >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui/plugin.xml,v >retrieving revision 1.408 >diff -u -r1.408 plugin.xml >--- plugin.xml 16 Oct 2007 14:17:54 -0000 1.408 >+++ plugin.xml 18 Oct 2007 20:32:34 -0000 >@@ -625,6 +625,18 @@ > parentId="org.eclipse.ui.defaultAcceleratorConfiguration" > id="org.eclipse.ui.emacsAcceleratorConfiguration"> > </scheme> >+ <key >+ commandId="org.eclipse.ui.navigate.nextPage" >+ contextId="org.eclipse.ui.contexts.window" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" >+ sequence="ALT+PAGE_UP"> >+ </key> >+ <key >+ commandId="org.eclipse.ui.navigate.previousPage" >+ contextId="org.eclipse.ui.contexts.window" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" >+ sequence="ALT+PAGE_DOWN"> >+ </key> > </extension> > > <extension >@@ -1074,6 +1086,18 @@ > description="%command.toggleCoolbar.description" > id="org.eclipse.ui.ToggleCoolbarAction" > name="%command.toggleCoolbar.name"/> >+ <command >+ categoryId="org.eclipse.ui.category.navigate" >+ description="%command.nextPage.description" >+ id="org.eclipse.ui.navigate.nextPage" >+ name="%command.nextPage.name"> >+ </command> >+ <command >+ categoryId="org.eclipse.ui.category.navigate" >+ description="%command.previousPage.description" >+ id="org.eclipse.ui.navigate.previousPage" >+ name="%command.previousPage.name"> >+ </command> > </extension> > > <extension >@@ -1839,6 +1863,30 @@ > </enabledWhen> > </handler> > <handler >+ class="org.eclipse.ui.part.PageBookView$CyclePageBookViewHandler" >+ commandId="org.eclipse.ui.navigate.nextPage"> >+ <enabledWhen> >+ <with >+ variable="activePart"> >+ <instanceof >+ value="org.eclipse.ui.part.PageBookView"> >+ </instanceof> >+ </with> >+ </enabledWhen> >+ </handler> >+ <handler >+ class="org.eclipse.ui.part.PageBookView$CyclePageBookViewHandler" >+ commandId="org.eclipse.ui.navigate.previousPage"> >+ <enabledWhen> >+ <with >+ variable="activePart"> >+ <instanceof >+ value="org.eclipse.ui.part.PageBookView"> >+ </instanceof> >+ </with> >+ </enabledWhen> >+ </handler> >+ <handler > class="org.eclipse.ui.internal.handlers.MaximizePartHandler" > commandId="org.eclipse.ui.window.maximizePart"> > <enabledWhen>
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
Flags:
markus.kell.r
:
review-
Actions:
View
|
Diff
Attachments on
bug 146623
:
80703
|
80790
|
81304
|
81450
|
81463
|
83339
|
83877
|
83898