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 189841 Details for
Bug 149719
[MPE] Allow tab style changes to MultiPageEditorPart
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Add getContainerStyle v03
bug149719-v03.txt (text/plain), 7.52 KB, created by
Paul Webster
on 2011-02-25 13:53:41 EST
(
hide
)
Description:
Add getContainerStyle v03
Filename:
MIME Type:
Creator:
Paul Webster
Created:
2011-02-25 13:53:41 EST
Size:
7.52 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.tests >Index: Eclipse UI Tests/org/eclipse/ui/tests/multipageeditor/MultiVariablePageEditor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/multipageeditor/MultiVariablePageEditor.java,v >retrieving revision 1.7 >diff -u -r1.7 MultiVariablePageEditor.java >--- Eclipse UI Tests/org/eclipse/ui/tests/multipageeditor/MultiVariablePageEditor.java 25 May 2009 20:52:54 -0000 1.7 >+++ Eclipse UI Tests/org/eclipse/ui/tests/multipageeditor/MultiVariablePageEditor.java 25 Feb 2011 18:52:01 -0000 >@@ -10,6 +10,7 @@ > *******************************************************************************/ > package org.eclipse.ui.tests.multipageeditor; > >+import org.eclipse.core.runtime.IConfigurationElement; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.jface.text.BadLocationException; > import org.eclipse.jface.text.FindReplaceDocumentAdapter; >@@ -34,6 +35,7 @@ > public class MultiVariablePageEditor extends MultiPageEditorPart { > > private Composite lastPage; >+ private boolean topStyle = false; > > /** > * Default with 2 pages, although they're on the same editor input and >@@ -159,4 +161,26 @@ > public Control getTestControl(int index) { > return getControl(index); > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.part.MultiPageEditorPart#getContainerStyle() >+ */ >+ protected int getContainerStyle() { >+ if (topStyle) { >+ return SWT.TOP | SWT.FLAT; >+ } >+ return super.getContainerStyle(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.part.EditorPart#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object) >+ */ >+ public void setInitializationData(IConfigurationElement cfig, >+ String propertyName, Object data) { >+ super.setInitializationData(cfig, propertyName, data); >+ System.out.println("setInitializationData: " + data); >+ if ("top".equals(data)) { >+ topStyle = true; >+ } >+ } > } >Index: Eclipse UI Tests/org/eclipse/ui/tests/multipageeditor/MultiVariablePageTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/multipageeditor/MultiVariablePageTest.java,v >retrieving revision 1.10 >diff -u -r1.10 MultiVariablePageTest.java >--- Eclipse UI Tests/org/eclipse/ui/tests/multipageeditor/MultiVariablePageTest.java 25 May 2009 20:52:54 -0000 1.10 >+++ Eclipse UI Tests/org/eclipse/ui/tests/multipageeditor/MultiVariablePageTest.java 25 Feb 2011 18:52:01 -0000 >@@ -56,6 +56,8 @@ > private static final String MTEST01_FILE = "mtest01.multivar"; > > private static final String MTEST02_FILE = "mtest02.multivar"; >+ >+ private static final String MTEST_TOP_FILE = "mtest02.multivarTop"; > > private static final String MULTI_VARIABLE_PROJ = "MultiVariableTest"; > >@@ -378,4 +380,36 @@ > IWorkbenchWindow window = openTestWindow(); > testTwoEditors(window, window.getPartService()); > } >+ >+ /** >+ * Make sure that setting the active page programmatically calls >+ * pageChanged(int) on the way. This method is overridden in a lot of >+ * editors to provide their functionality on page changes. >+ * >+ * @throws Throwable >+ */ >+ public void testSetActivePageOnTop() throws Throwable { >+ // Open a new test window. >+ // Create and open a blurb file. >+ IWorkbenchWindow window = openTestWindow(); >+ IEditorPart part = openMultivarFile(window, MTEST_TOP_FILE); >+ >+ MultiVariablePageEditor editor = (MultiVariablePageEditor) part; >+ >+ editor.setPage(1); >+ ISelection selection = editor.getEditorSite().getSelectionProvider() >+ .getSelection(); >+ TextSelection text = (TextSelection) selection; >+ // when we change to the second page, the selection should be >+ // updated. >+ assertEquals("#section02", text.getText()); >+ >+ editor.setPage(0); >+ selection = editor.getEditorSite().getSelectionProvider() >+ .getSelection(); >+ text = (TextSelection) selection; >+ // when we change back to the first page, the selection should be >+ // updated. >+ assertEquals("#section01", text.getText()); >+ } > } >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/plugin.xml,v >retrieving revision 1.292 >diff -u -r1.292 plugin.xml >--- plugin.xml 1 Feb 2011 15:30:56 -0000 1.292 >+++ plugin.xml 25 Feb 2011 18:52:01 -0000 >@@ -741,6 +741,12 @@ > id="org.eclipse.ui.tests.multipageeditor.MultiVariablePageEditor" > name="Multi Variable Page Editor"/> > <editor >+ class="org.eclipse.ui.tests.multipageeditor.MultiVariablePageEditor:top" >+ extensions="multivarTop" >+ icon="icons/mockeditorpart1.gif" >+ id="org.eclipse.ui.tests.multipageeditor.MultiVariablePageEditorTop" >+ name="Multi Variable Page Editor TopTab"/> >+ <editor > class="org.eclipse.ui.tests.manual.TestBackgroundSaveEditor" > default="false" > extensions="background" >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/part/MultiPageEditorPart.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorPart.java,v >retrieving revision 1.62 >diff -u -r1.62 MultiPageEditorPart.java >--- Eclipse UI/org/eclipse/ui/part/MultiPageEditorPart.java 1 Jun 2010 19:22:36 -0000 1.62 >+++ Eclipse UI/org/eclipse/ui/part/MultiPageEditorPart.java 25 Feb 2011 18:52:01 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -93,6 +93,10 @@ > * to be notified about all page change events within the workbench page or > * workbench window. > * </p> >+ * <p> >+ * Subclasses may provide a hint for constructing the container using >+ * {@link #getContainerStyle()}. The hint may be ignored. >+ * </p> > * > * @see org.eclipse.ui.part.MultiPageEditorActionBarContributor > * @see org.eclipse.jface.dialogs.IPageChangeProvider >@@ -279,11 +283,8 @@ > * @return a new container > */ > private CTabFolder createContainer(Composite parent) { >- // use SWT.FLAT style so that an extra 1 pixel border is not reserved >- // inside the folder > parent.setLayout(new FillLayout()); >- final CTabFolder newContainer = new CTabFolder(parent, SWT.BOTTOM >- | SWT.FLAT); >+ final CTabFolder newContainer = new CTabFolder(parent, getContainerStyle()); > newContainer.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > int newPageIndex = newContainer.indexOf((CTabItem) e.item); >@@ -308,6 +309,23 @@ > } > > /** >+ * A hint for the styles to use while constructing the container. The >+ * <code>MultiPageEditorPart</code> implementation supports following >+ * styles: SWT.TOP, SWT.BOTTOM, SWT.FLAT >+ * <p> >+ * Subclasses may override. >+ * </p> >+ * >+ * @return the styles to use. By default, SWT.BOTTOM | SWT.FLAT >+ * @since 3.7 >+ */ >+ protected int getContainerStyle() { >+ // use SWT.FLAT style so that an extra 1 pixel border is not reserved >+ // inside the folder >+ return SWT.BOTTOM | SWT.FLAT; >+ } >+ >+ /** > * Creates a tab item at the given index and places the given control in the > * new item. The item is a CTabItem with no style bits set. > *
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 149719
:
115958
|
186879
| 189841