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 75144 Details for
Bug 131855
[TabbedProperties] Provide dynamic tab and section support
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch for Dynamic Tab and Section Support
131855 Aug 1.txt (text/plain), 253.04 KB, created by
Anthony Hunter
on 2007-08-01 14:27:30 EDT
(
hide
)
Description:
Patch for Dynamic Tab and Section Support
Filename:
MIME Type:
Creator:
Anthony Hunter
Created:
2007-08-01 14:27:30 EDT
Size:
253.04 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.tests.views.properties.tabbed >Index: src/org/eclipse/ui/tests/views/properties/tabbed/views/TestsPerspective.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/views/TestsPerspective.java,v >retrieving revision 1.1 >diff -u -r1.1 TestsPerspective.java >--- src/org/eclipse/ui/tests/views/properties/tabbed/views/TestsPerspective.java 22 Feb 2007 02:42:53 -0000 1.1 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/views/TestsPerspective.java 1 Aug 2007 18:26:05 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007 IBM Corporation and others. >+ * Copyright (c) 2007, 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 >@@ -14,26 +14,33 @@ > import org.eclipse.ui.IFolderLayout; > import org.eclipse.ui.IPageLayout; > import org.eclipse.ui.IPerspectiveFactory; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsView; >+import org.eclipse.ui.tests.views.properties.tabbed.text.TextTestsView; > > /** > * Perspective used by the tabbed properties view test JUnit tests. > * > * @since 3.3 > */ >-public class TestsPerspective >- implements IPerspectiveFactory { >+public class TestsPerspective implements IPerspectiveFactory { > >- public static final String TESTS_PERSPECTIVE_ID = "org.eclipse.ui.tests.views.properties.tabbed.views.TestsPerspective"; //$NON-NLS-1$ >+ public static final String TESTS_PERSPECTIVE_ID = "org.eclipse.ui.tests.views.properties.tabbed.views.TestsPerspective"; //$NON-NLS-1$ > >- public void createInitialLayout(IPageLayout layout) { >- String editorArea = layout.getEditorArea(); >- IFolderLayout left = layout.createFolder( >- "left", IPageLayout.LEFT, (float) 0.25, editorArea);//$NON-NLS-1$ >- left.addView(TestsView.TESTS_VIEW_ID); >- IFolderLayout bottom = layout.createFolder( >- "bottom", IPageLayout.BOTTOM, (float) 0.75,//$NON-NLS-1$ >- editorArea); >- bottom.addView(IPageLayout.ID_PROP_SHEET); >- } >+ public void createInitialLayout(IPageLayout layout) { >+ String editorArea = layout.getEditorArea(); >+ IFolderLayout topLeft = layout.createFolder( >+ "topLeft", IPageLayout.LEFT, (float) 0.50, editorArea);//$NON-NLS-1$ >+ topLeft.addView(TestsView.TESTS_VIEW_ID); >+ IFolderLayout bottomLeft = layout.createFolder( >+ "bottomLeft", IPageLayout.BOTTOM, (float) 0.50, "topLeft");//$NON-NLS-1$//$NON-NLS-2$ >+ bottomLeft.addView(DynamicTestsView.DYNAMIC_TESTS_VIEW_ID); >+ IFolderLayout top = layout.createFolder( >+ "top", IPageLayout.TOP, (float) 0.25, editorArea);//$NON-NLS-1$ >+ top.addView(TextTestsView.TEXT_TESTS_VIEW_ID); >+ IFolderLayout bottom = layout.createFolder( >+ "bottom", IPageLayout.BOTTOM, (float) 0.25,//$NON-NLS-1$ >+ editorArea); >+ bottom.addView(IPageLayout.ID_PROP_SHEET); >+ } > > } >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests.views.properties.tabbed/plugin.xml,v >retrieving revision 1.5 >diff -u -r1.5 plugin.xml >--- plugin.xml 22 Feb 2007 02:42:53 -0000 1.5 >+++ plugin.xml 1 Aug 2007 18:26:05 -0000 >@@ -14,6 +14,20 @@ > class="org.eclipse.ui.tests.views.properties.tabbed.views.TestsView" > id="org.eclipse.ui.tests.views.properties.tabbed.views.TestsView"> > </view> >+ <view >+ name="%Views.dynamic.name" >+ icon="icons/sample.gif" >+ category="org.eclipse.ui.views.properties.tabbed" >+ class="org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsView" >+ id="org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsView"> >+ </view> >+ <view >+ name="%Views.text.name" >+ icon="icons/sample.gif" >+ category="org.eclipse.ui.views.properties.tabbed" >+ class="org.eclipse.ui.tests.views.properties.tabbed.text.TextTestsView" >+ id="org.eclipse.ui.tests.views.properties.tabbed.text.TextTestsView"> >+ </view> > </extension> > <extension > point="org.eclipse.ui.views.properties.tabbed.propertyContributor"> >@@ -157,5 +171,177 @@ > </perspective> > </extension> > >+ <extension >+ point="org.eclipse.ui.views.properties.tabbed.propertyContributor"> >+ <propertyContributor >+ contributorId="org.eclipse.ui.tests.views.properties.tabbed.static" >+ labelProvider="org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsTitleBarLabelProvider" >+ typeMapper="org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsTypeMapper"> >+ <propertyCategory >+ category="default"> >+ </propertyCategory> >+ <propertyCategory >+ category="advanced"> >+ </propertyCategory> >+ </propertyContributor> >+ </extension> >+ >+ <extension >+ point="org.eclipse.ui.views.properties.tabbed.propertyTabs"> >+ <propertyTabs contributorId="org.eclipse.ui.tests.views.properties.tabbed.static"> >+ <propertyTab >+ category="default" >+ id="ElementTab" >+ label="Element"/> >+ <propertyTab >+ afterTab="ElementTab" >+ category="default" >+ id="ColorTab" >+ label="Color"/> >+ <propertyTab >+ afterTab="ColorTab" >+ category="default" >+ id="ShapeTab" >+ label="Shape"/> >+ <propertyTab >+ category="advanced" >+ id="AdvancedTab" >+ label="Advanced"> >+ </propertyTab> >+ </propertyTabs> >+ </extension> >+ >+ <extension >+ point="org.eclipse.ui.views.properties.tabbed.propertySections"> >+ <propertySections >+ contributorId="org.eclipse.ui.tests.views.properties.tabbed.static"> >+ <propertySection >+ class="org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections.DynamicTestsElementSection" >+ id="ElementSection" >+ tab="ElementTab"> >+ <input >+ type="org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsElement"> >+ </input> >+ </propertySection> >+ <propertySection >+ class="org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections.DynamicTestsRedSection" >+ filter="org.eclipse.ui.tests.views.properties.tabbed.dynamic.filters.DynamicTestsRedSectionFilter" >+ id="RedSection" >+ tab="ColorTab"> >+ </propertySection> >+ <propertySection >+ class="org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections.DynamicTestsGreenSection" >+ filter="org.eclipse.ui.tests.views.properties.tabbed.dynamic.filters.DynamicTestsGreenSectionFilter" >+ id="GreenSection" >+ tab="ColorTab"> >+ </propertySection> >+ <propertySection >+ class="org.eclipse.ui.views.properties.tabbed.AdvancedPropertySection" >+ enablesFor="1" >+ id="AdvancedSection" >+ tab="AdvancedTab"> >+ <input type="org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsElement"/> >+ </propertySection> >+ <propertySection >+ class="org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections.DynamicTestsBlueSection" >+ filter="org.eclipse.ui.tests.views.properties.tabbed.dynamic.filters.DynamicTestsBlueSectionFilter" >+ id="BlueSection" >+ tab="ColorTab"> >+ </propertySection> >+ <propertySection >+ class="org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections.DynamicTestsSquareSection" >+ filter="org.eclipse.ui.tests.views.properties.tabbed.dynamic.filters.DynamicTestsSquareSectionFilter" >+ id="SquareSection" >+ tab="ShapeTab"> >+ </propertySection> >+ <propertySection >+ class="org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections.DynamicTestsTriangleSection" >+ filter="org.eclipse.ui.tests.views.properties.tabbed.dynamic.filters.DynamicTestsTriangleSectionFilter" >+ id="TriangleSection" >+ tab="ShapeTab"> >+ </propertySection> >+ <propertySection >+ class="org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections.DynamicTestsCircleSection" >+ filter="org.eclipse.ui.tests.views.properties.tabbed.dynamic.filters.DynamicTestsCircleSectionFilter" >+ id="CircleSection" >+ tab="ShapeTab"> >+ </propertySection> >+ </propertySections> >+ </extension> >+ >+ <extension >+ point="org.eclipse.ui.views.properties.tabbed.propertyContributor"> >+ <propertyContributor >+ contributorId="org.eclipse.ui.tests.views.properties.tabbed.dynamic.section" >+ labelProvider="org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsTitleBarLabelProvider" >+ sectionDescriptorProvider="org.eclipse.ui.tests.views.properties.tabbed.dynamic.section.descriptors.DynamicTestsSectionDescriptorProvider" >+ typeMapper="org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsTypeMapper"> >+ <propertyCategory >+ category="default"> >+ </propertyCategory> >+ <propertyCategory >+ category="advanced"> >+ </propertyCategory> >+ </propertyContributor> >+ </extension> >+ >+ <extension >+ point="org.eclipse.ui.views.properties.tabbed.propertyTabs"> >+ <propertyTabs contributorId="org.eclipse.ui.tests.views.properties.tabbed.dynamic.section"> >+ <propertyTab >+ category="default" >+ id="ElementTab" >+ label="Element"/> >+ <propertyTab >+ afterTab="ElementTab" >+ category="default" >+ id="ColorTab" >+ label="Color"/> >+ <propertyTab >+ afterTab="ColorTab" >+ category="default" >+ id="ShapeTab" >+ label="Shape"/> >+ <propertyTab >+ category="advanced" >+ id="AdvancedTab" >+ label="Advanced"> >+ </propertyTab> >+ <propertyTab >+ afterTab="ColorTab" >+ category="default" >+ id="StarTab" >+ indented="true" >+ label="Star"> >+ </propertyTab> >+ </propertyTabs> >+ </extension> >+ >+ <extension >+ point="org.eclipse.ui.views.properties.tabbed.propertyContributor"> >+ <propertyContributor >+ contributorId="org.eclipse.ui.tests.views.properties.tabbed.dynamic.tab" >+ labelProvider="org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsTitleBarLabelProvider" >+ tabDescriptorProvider="org.eclipse.ui.tests.views.properties.tabbed.dynamic.tab.descriptors.DynamicTestsTabDescriptorProvider" >+ typeMapper="org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsTypeMapper"> >+ <propertyCategory >+ category="default"> >+ </propertyCategory> >+ <propertyCategory >+ category="advanced"> >+ </propertyCategory> >+ </propertyContributor> >+ </extension> > >+ <extension >+ point="org.eclipse.ui.views.properties.tabbed.propertyContributor"> >+ <propertyContributor >+ contributorId="org.eclipse.ui.tests.views.properties.tabbed.text" >+ labelProvider="org.eclipse.ui.tests.views.properties.tabbed.text.TextTestsLabelProvider" >+ tabDescriptorProvider="org.eclipse.ui.tests.views.properties.tabbed.text.TextTestsTabDescriptorProvider"> >+ <propertyCategory >+ category="default"> >+ </propertyCategory> >+ </propertyContributor> >+ </extension> > </plugin> >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests.views.properties.tabbed/plugin.properties,v >retrieving revision 1.2 >diff -u -r1.2 plugin.properties >--- plugin.properties 22 Feb 2007 02:42:53 -0000 1.2 >+++ plugin.properties 1 Aug 2007 18:26:05 -0000 >@@ -13,4 +13,6 @@ > > Views.category.name = Tabbed Properties View > Views.example.name = Tabbed Properties Tests View >+Views.dynamic.name = Tabbed Properties Dynamic Tests View >+Views.text.name = Tabbed Properties Text Tests View > Views.example.perspective = Tabbed Properties View Tests Perspective >\ No newline at end of file >Index: src/org/eclipse/ui/tests/views/properties/tabbed/AllTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/AllTests.java,v >retrieving revision 1.1 >diff -u -r1.1 AllTests.java >--- src/org/eclipse/ui/tests/views/properties/tabbed/AllTests.java 30 Jan 2006 21:34:35 -0000 1.1 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/AllTests.java 1 Aug 2007 18:26:05 -0000 >@@ -1,31 +1,33 @@ >-/******************************************************************************* >- * Copyright (c) 2006 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.tests.views.properties.tabbed; >- >-import junit.framework.Test; >-import junit.framework.TestCase; >-import junit.framework.TestSuite; >-import junit.textui.TestRunner; >- >-public class AllTests >- extends TestCase { >- >- public static void main(String[] args) { >- TestRunner.run(suite()); >- } >- >- public static Test suite() { >- TestSuite suite = new TestSuite(); >- suite.addTestSuite(TabbedPropertySheetPageTest.class); >- return suite; >- } >- >-} >+/******************************************************************************* >+ * Copyright (c) 2006, 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.tests.views.properties.tabbed; >+ >+import junit.framework.Test; >+import junit.framework.TestCase; >+import junit.framework.TestSuite; >+import junit.textui.TestRunner; >+ >+public class AllTests >+ extends TestCase { >+ >+ public static void main(String[] args) { >+ TestRunner.run(suite()); >+ } >+ >+ public static Test suite() { >+ TestSuite suite = new TestSuite(); >+ suite.addTestSuite(TabbedPropertySheetPageTest.class); >+ suite.addTestSuite(TabbedPropertySheetPageDynamicTest.class); >+ suite.addTestSuite(TabbedPropertySheetPageTextTest.class); >+ return suite; >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageTest.java,v >retrieving revision 1.3 >diff -u -r1.3 TabbedPropertySheetPageTest.java >--- src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageTest.java 22 Feb 2007 02:42:53 -0000 1.3 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageTest.java 1 Aug 2007 18:26:05 -0000 >@@ -17,12 +17,10 @@ > import org.eclipse.jface.viewers.TreeNode; > import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Display; >-import org.eclipse.ui.IPageLayout; > import org.eclipse.ui.IViewPart; > import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.PlatformUI; >-import org.eclipse.ui.internal.views.properties.tabbed.view.Tab; > import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyComposite; > import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyList; > import org.eclipse.ui.tests.views.properties.tabbed.sections.InformationTwoSection; >@@ -31,12 +29,11 @@ > import org.eclipse.ui.tests.views.properties.tabbed.views.TestsView; > import org.eclipse.ui.tests.views.properties.tabbed.views.TestsViewContentProvider; > import org.eclipse.ui.views.properties.tabbed.ISection; >+import org.eclipse.ui.views.properties.tabbed.TabContents; > > public class TabbedPropertySheetPageTest > extends TestCase { > >- private IViewPart propertiesView; >- > private TestsView testsView; > > private TreeNode[] treeNodes; >@@ -46,24 +43,23 @@ > super.setUp(); > > /** >- * Open the tests perspective. >+ * Close the existing perspectives. > */ > IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench() > .getActiveWorkbenchWindow(); > assertNotNull(workbenchWindow); > IWorkbenchPage workbenchPage = workbenchWindow.getActivePage(); > assertNotNull(workbenchPage); >- PlatformUI.getWorkbench().showPerspective( >- TestsPerspective.TESTS_PERSPECTIVE_ID, workbenchWindow); >+ workbenchPage.closeAllPerspectives(false, false); > > /** >- * Open the properties view. >+ * Open the tests perspective. > */ >- propertiesView = workbenchPage.showView(IPageLayout.ID_PROP_SHEET); >- assertNotNull(propertiesView); >+ PlatformUI.getWorkbench().showPerspective( >+ TestsPerspective.TESTS_PERSPECTIVE_ID, workbenchWindow); > > /** >- * Open the Tests view. >+ * Select the Tests view. > */ > IViewPart view = workbenchPage.showView(TestsView.TESTS_VIEW_ID); > assertNotNull(view); >@@ -86,29 +82,16 @@ > super.tearDown(); > > /** >- * Bug 175070: Make sure the views have finished painting before hiding them >+ * Bug 175070: Make sure the views have finished painting. > */ > while (Display.getCurrent().readAndDispatch()) { > // > } > > /** >- * Close the properties view. >+ * Deselect everything in the Tests view. > */ >- IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench() >- .getActiveWorkbenchWindow(); >- assertNotNull(workbenchWindow); >- IWorkbenchPage workbenchPage = workbenchWindow.getActivePage(); >- assertNotNull(workbenchPage); >- workbenchPage.hideView(propertiesView); >- propertiesView = null; >- /** >- * Close the Tests view. >- */ >- workbenchPage.hideView(testsView); >- testsView = null; >- >- treeNodes = null; >+ setSelection(new TreeNode[] {} ); > } > > /** >@@ -202,11 +185,11 @@ > * First tab is Information > */ > assertEquals(tabbedPropertyList.getElementAt(0).toString(), "Name");//$NON-NLS-1$ >- Tab tab = testsView.getTabbedPropertySheetPage().getCurrentTab(); >+ TabContents tabContents = testsView.getTabbedPropertySheetPage().getCurrentTab(); > /** > * the tab has two sections. > */ >- ISection[] sections = tab.getSections(); >+ ISection[] sections = tabContents.getSections(); > assertEquals(sections.length, 2); > assertEquals(sections[0].getClass(), NameSection.class); > assertEquals(sections[1].getClass(), InformationTwoSection.class); >@@ -258,8 +241,8 @@ > * viewer. > */ > public void test_noPropertiesAvailable() { >- Tab tab = testsView.getTabbedPropertySheetPage().getCurrentTab(); >- assertNull(tab); >+ TabContents tabContents = testsView.getTabbedPropertySheetPage().getCurrentTab(); >+ assertNull(tabContents); > TabbedPropertyList tabbedPropertyList = getTabbedPropertyList(); > assertNull(tabbedPropertyList.getElementAt(0)); > } >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests.views.properties.tabbed/META-INF/MANIFEST.MF,v >retrieving revision 1.6 >diff -u -r1.6 MANIFEST.MF >--- META-INF/MANIFEST.MF 4 Jun 2007 21:10:40 -0000 1.6 >+++ META-INF/MANIFEST.MF 1 Aug 2007 18:26:05 -0000 >@@ -2,14 +2,15 @@ > Bundle-ManifestVersion: 2 > Bundle-Name: %Plugin.name > Bundle-SymbolicName: org.eclipse.ui.tests.views.properties.tabbed;singleton:=true >-Bundle-Version: 3.3.0.qualifier >+Bundle-Version: 3.4.0.qualifier > Bundle-Activator: org.eclipse.ui.tests.views.properties.tabbed.Activator > Bundle-Localization: plugin > Require-Bundle: org.eclipse.ui, > org.eclipse.core.runtime, > org.junit, > org.eclipse.ui.ide, >- org.eclipse.ui.views.properties.tabbed >+ org.eclipse.ui.views.properties.tabbed, >+ org.eclipse.jface.text > Eclipse-LazyStart: true > Bundle-Vendor: %Plugin.providerName > Bundle-ClassPath: uitptests.jar >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsGreenSectionDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsGreenSectionDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsGreenSectionDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsGreenSectionDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,54 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.section.descriptors; >+ >+import org.eclipse.jface.viewers.IFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.filters.DynamicTestsGreenSectionFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections.DynamicTestsGreenSection; >+import org.eclipse.ui.views.properties.tabbed.AbstractSectionDescriptor; >+import org.eclipse.ui.views.properties.tabbed.ISection; >+import org.eclipse.ui.views.properties.tabbed.ITypeMapper; >+ >+/** >+ * A section descriptor for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsGreenSectionDescriptor extends >+ AbstractSectionDescriptor { >+ >+ /** >+ * Constructor for DynamicTestsGreenSectionDescriptor. >+ * >+ * @param typeMapper >+ * the optional type mapper for the section. >+ */ >+ public DynamicTestsGreenSectionDescriptor(ITypeMapper typeMapper) { >+ super(typeMapper); >+ } >+ >+ public IFilter getFilter() { >+ return new DynamicTestsGreenSectionFilter(); >+ } >+ >+ public String getId() { >+ return "DynamicTestsGreenSection"; //$NON-NLS-1$ >+ } >+ >+ public ISection getSectionClass() { >+ return new DynamicTestsGreenSection(); >+ } >+ >+ public String getTargetTab() { >+ return "ColorTab"; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsSectionDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsSectionDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsSectionDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsSectionDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,42 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.text; >+ >+import org.eclipse.ui.views.properties.tabbed.AbstractSectionDescriptor; >+import org.eclipse.ui.views.properties.tabbed.ISection; >+ >+/** >+ * A section descriptor for the text test view. >+ * >+ * @author Anthony Hunter >+ */ >+public class TextTestsSectionDescriptor extends AbstractSectionDescriptor { >+ >+ private String word; >+ >+ public TextTestsSectionDescriptor(String aWord) { >+ super(null); >+ this.word = aWord; >+ } >+ >+ public String getId() { >+ return word; >+ } >+ >+ public ISection getSectionClass() { >+ return new TextTestsLabelSection(word); >+ } >+ >+ public String getTargetTab() { >+ return word; >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsTypeMapper.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsTypeMapper.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsTypeMapper.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsTypeMapper.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,30 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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.tests.views.properties.tabbed.dynamic.views; >+ >+import org.eclipse.ui.views.properties.tabbed.AbstractTypeMapper; >+ >+/** >+ * A type mapper for nodes in the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsTypeMapper extends AbstractTypeMapper { >+ >+ public Class mapType(Object object) { >+ if (object instanceof DynamicTestsTreeNode) { >+ return ((DynamicTestsTreeNode) object).getDynamicTestsElement() >+ .getClass(); >+ } >+ return super.mapType(object); >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsSquareSection.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsSquareSection.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsSquareSection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsSquareSection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,28 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.sections; >+ >+/** >+ * A section for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsSquareSection extends DynamicTestsAbstractLabelSection { >+ >+ public String getGroup() { >+ return "Shape"; //$NON-NLS-1$ >+ } >+ >+ public String getLabel() { >+ return "A section for square elements."; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/model/DynamicTestsColor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/model/DynamicTestsColor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/model/DynamicTestsColor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/model/DynamicTestsColor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,69 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.model; >+ >+/** >+ * A color enumeration for the dynamic tests view. (Should use an enum when we >+ * can use Java 5). >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsColor { >+ >+ public static final DynamicTestsColor BLACK = new DynamicTestsColor("black"); //$NON-NLS-1$ >+ >+ public static final DynamicTestsColor BLUE = new DynamicTestsColor("blue"); //$NON-NLS-1$ >+ >+ public static final DynamicTestsColor GREEN = new DynamicTestsColor("green"); //$NON-NLS-1$ >+ >+ public static final DynamicTestsColor RED = new DynamicTestsColor("red"); //$NON-NLS-1$ >+ >+ /** >+ * @return the color >+ */ >+ public static DynamicTestsColor getColor(String value) { >+ if (RED.getColor().equals(value)) { >+ return RED; >+ } else if (GREEN.getColor().equals(value)) { >+ return GREEN; >+ } else if (BLUE.getColor().equals(value)) { >+ return BLUE; >+ } else if (BLACK.getColor().equals(value)) { >+ return BLACK; >+ } >+ return null; >+ } >+ >+ private String color; >+ >+ private DynamicTestsColor(String aColor) { >+ setColor(aColor); >+ } >+ >+ /** >+ * @return the color >+ */ >+ public String getColor() { >+ return color; >+ } >+ >+ /** >+ * @param color >+ * the color to set >+ */ >+ public void setColor(String aColor) { >+ this.color = aColor; >+ } >+ >+ public String toString() { >+ return getColor(); >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsRedSectionFilter.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsRedSectionFilter.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsRedSectionFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsRedSectionFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,26 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.filters; >+ >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsColor; >+ >+/** >+ * A section filter for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsRedSectionFilter extends >+ DynamicTestsElementSectionFilter { >+ >+ protected boolean appliesToColor(DynamicTestsColor color) { >+ return DynamicTestsColor.RED.equals(color); >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsView.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsView.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsView.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsView.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,96 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.text; >+ >+import org.eclipse.jface.text.Document; >+import org.eclipse.jface.text.TextViewer; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.FormAttachment; >+import org.eclipse.swt.layout.FormData; >+import org.eclipse.swt.layout.FormLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.ui.part.ViewPart; >+import org.eclipse.ui.views.properties.IPropertySheetPage; >+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; >+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor; >+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; >+ >+/** >+ * A text view to test dynamic contributions to the tabbed properties view. >+ * >+ * @author Anthony Hunter >+ */ >+public class TextTestsView extends ViewPart implements >+ ITabbedPropertySheetPageContributor { >+ >+ public static final String TEXT_TESTS_VIEW_ID = "org.eclipse.ui.tests.views.properties.tabbed.text.TextTestsView"; //$NON-NLS-1$ >+ >+ private TabbedPropertySheetPage tabbedPropertySheetPage; >+ >+ private TextViewer viewer; >+ >+ public void createPartControl(Composite parent) { >+ Composite composite = new Composite(parent, SWT.NONE); >+ FormLayout layout = new FormLayout(); >+ layout.marginWidth = ITabbedPropertyConstants.HSPACE; >+ layout.marginHeight = ITabbedPropertyConstants.VSPACE; >+ layout.spacing = ITabbedPropertyConstants.VMARGIN; >+ composite.setLayout(layout); >+ >+ Label label = new Label(composite, SWT.NONE); >+ label.setText("Enter text, selected words becomes tabs and sections"); >+ FormData data = new FormData(); >+ data.left = new FormAttachment(0, 0); >+ data.right = new FormAttachment(100, 0); >+ data.top = new FormAttachment(0, 0); >+ label.setLayoutData(data); >+ >+ viewer = new TextViewer(composite, SWT.WRAP | SWT.H_SCROLL | >+ SWT.V_SCROLL | SWT.BORDER); >+ viewer.setDocument(new Document()); >+ data = new FormData(); >+ data.left = new FormAttachment(0, 0); >+ data.right = new FormAttachment(100, 0); >+ data.top = new FormAttachment(label, 0); >+ data.bottom = new FormAttachment(100, 0); >+ viewer.getControl().setLayoutData(data); >+ >+ getSite().setSelectionProvider(viewer); >+ } >+ >+ public Object getAdapter(Class adapter) { >+ if (adapter == IPropertySheetPage.class) { >+ if (tabbedPropertySheetPage == null) { >+ tabbedPropertySheetPage = new TabbedPropertySheetPage(this); >+ } >+ return tabbedPropertySheetPage; >+ } >+ return super.getAdapter(adapter); >+ } >+ >+ public String getContributorId() { >+ return "org.eclipse.ui.tests.views.properties.tabbed.text"; //$NON-NLS-1$ >+ } >+ >+ public TabbedPropertySheetPage getTabbedPropertySheetPage() { >+ return tabbedPropertySheetPage; >+ } >+ >+ public TextViewer getViewer() { >+ return viewer; >+ } >+ >+ public void setFocus() { >+ viewer.getControl().setFocus(); >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsSquareSectionFilter.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsSquareSectionFilter.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsSquareSectionFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsSquareSectionFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,26 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.filters; >+ >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsShape; >+ >+/** >+ * A section filter for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsSquareSectionFilter extends >+ DynamicTestsElementSectionFilter { >+ >+ protected boolean appliesToShape(DynamicTestsShape shape) { >+ return DynamicTestsShape.SQUARE.equals(shape); >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsBlackTabDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsBlackTabDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsBlackTabDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsBlackTabDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,62 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.tab.descriptors; >+ >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.ui.tests.views.properties.tabbed.Activator; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.section.descriptors.DynamicTestsBlackSectionDescriptor; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsTypeMapper; >+import org.eclipse.ui.views.properties.tabbed.AbstractTabDescriptor; >+ >+/** >+ * A tab descriptor for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsBlackTabDescriptor extends AbstractTabDescriptor { >+ private Image image; >+ >+ public DynamicTestsBlackTabDescriptor() { >+ super(); >+ getSectionDescriptors().add( >+ new DynamicTestsBlackSectionDescriptor( >+ new DynamicTestsTypeMapper())); >+ } >+ >+ public String getAfterTab() { >+ return "ColorTab"; //$NON-NLS-1$ >+ } >+ >+ public String getCategory() { >+ return "default"; //$NON-NLS-1$ >+ } >+ >+ public String getId() { >+ return "BlackTab"; //$NON-NLS-1$ >+ } >+ >+ public Image getImage() { >+ if (image == null) { >+ image = Activator >+ .getImageDescriptor("icons/black_triangle.gif").createImage(); //$NON-NLS-1$ >+ } >+ return image; >+ } >+ >+ public String getLabel() { >+ return "Black"; //$NON-NLS-1$ >+ } >+ >+ public boolean isIndented() { >+ return true; >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsBlackSection.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsBlackSection.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsBlackSection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsBlackSection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,28 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.sections; >+ >+/** >+ * A section for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsBlackSection extends DynamicTestsAbstractLabelSection { >+ >+ public String getGroup() { >+ return "Black"; //$NON-NLS-1$ >+ } >+ >+ public String getLabel() { >+ return "A section for black elements."; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsColorTabDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsColorTabDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsColorTabDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsColorTabDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,55 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.tab.descriptors; >+ >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.section.descriptors.DynamicTestsBlueSectionDescriptor; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.section.descriptors.DynamicTestsGreenSectionDescriptor; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.section.descriptors.DynamicTestsRedSectionDescriptor; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsTypeMapper; >+import org.eclipse.ui.views.properties.tabbed.AbstractTabDescriptor; >+ >+/** >+ * A tab descriptor for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsColorTabDescriptor extends AbstractTabDescriptor { >+ >+ public DynamicTestsColorTabDescriptor() { >+ super(); >+ getSectionDescriptors().add( >+ new DynamicTestsRedSectionDescriptor( >+ new DynamicTestsTypeMapper())); >+ getSectionDescriptors().add( >+ new DynamicTestsGreenSectionDescriptor( >+ new DynamicTestsTypeMapper())); >+ getSectionDescriptors().add( >+ new DynamicTestsBlueSectionDescriptor( >+ new DynamicTestsTypeMapper())); >+ } >+ >+ public String getAfterTab() { >+ return "ElementTab"; //$NON-NLS-1$ >+ } >+ >+ public String getCategory() { >+ return "default"; //$NON-NLS-1$ >+ } >+ >+ public String getId() { >+ return "ColorTab"; //$NON-NLS-1$ >+ } >+ >+ public String getLabel() { >+ return "Color"; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsTabDescriptorProvider.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsTabDescriptorProvider.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsTabDescriptorProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsTabDescriptorProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,50 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.text; >+ >+import java.util.ArrayList; >+import java.util.List; >+import java.util.StringTokenizer; >+ >+import org.eclipse.jface.text.ITextSelection; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.views.properties.tabbed.ITabDescriptor; >+import org.eclipse.ui.views.properties.tabbed.ITabDescriptorProvider; >+ >+/** >+ * A tab descriptor for the text test view. >+ * >+ * @author Anthony Hunter >+ */ >+public class TextTestsTabDescriptorProvider implements ITabDescriptorProvider { >+ >+ public ITabDescriptor[] getTabDescriptors(IWorkbenchPart part, >+ ISelection selection) { >+ if (selection instanceof ITextSelection) { >+ ITextSelection textSelection = (ITextSelection) selection; >+ if (textSelection.getLength() != 0) { >+ List result = new ArrayList(); >+ StringTokenizer tokenizer = new StringTokenizer(textSelection >+ .getText()); >+ while (tokenizer.hasMoreTokens()) { >+ result >+ .add(new TextTestsTabDescriptor(tokenizer >+ .nextToken())); >+ } >+ return (ITabDescriptor[]) result >+ .toArray(new ITabDescriptor[result.size()]); >+ } >+ } >+ return new ITabDescriptor[0]; >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsCircleSectionDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsCircleSectionDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsCircleSectionDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsCircleSectionDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,54 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.section.descriptors; >+ >+import org.eclipse.jface.viewers.IFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.filters.DynamicTestsCircleSectionFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections.DynamicTestsCircleSection; >+import org.eclipse.ui.views.properties.tabbed.AbstractSectionDescriptor; >+import org.eclipse.ui.views.properties.tabbed.ISection; >+import org.eclipse.ui.views.properties.tabbed.ITypeMapper; >+ >+/** >+ * A section descriptor for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsCircleSectionDescriptor extends >+ AbstractSectionDescriptor { >+ >+ /** >+ * Constructor for DynamicTestsCircleSectionDescriptor. >+ * >+ * @param typeMapper >+ * the optional type mapper for the section. >+ */ >+ public DynamicTestsCircleSectionDescriptor(ITypeMapper typeMapper) { >+ super(typeMapper); >+ } >+ >+ public IFilter getFilter() { >+ return new DynamicTestsCircleSectionFilter(); >+ } >+ >+ public String getId() { >+ return "DynamicTestsCircleSection"; //$NON-NLS-1$ >+ } >+ >+ public ISection getSectionClass() { >+ return new DynamicTestsCircleSection(); >+ } >+ >+ public String getTargetTab() { >+ return "ShapeTab"; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsBlackSectionFilter.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsBlackSectionFilter.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsBlackSectionFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsBlackSectionFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,26 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.filters; >+ >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsColor; >+ >+/** >+ * A section filter for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsBlackSectionFilter extends >+ DynamicTestsElementSectionFilter { >+ >+ protected boolean appliesToColor(DynamicTestsColor color) { >+ return DynamicTestsColor.BLACK.equals(color); >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/model/DynamicTestsShape.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/model/DynamicTestsShape.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/model/DynamicTestsShape.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/model/DynamicTestsShape.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,73 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.model; >+ >+/** >+ * A shape enumeration for the dynamic tests view. (Should use an enum when we >+ * can use Java 5). >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsShape { >+ >+ public static final DynamicTestsShape CIRCLE = new DynamicTestsShape( >+ "circle"); //$NON-NLS-1$ >+ >+ public static final DynamicTestsShape SQUARE = new DynamicTestsShape( >+ "square"); //$NON-NLS-1$ >+ >+ public static final DynamicTestsShape STAR = new DynamicTestsShape("star"); //$NON-NLS-1$ >+ >+ public static final DynamicTestsShape TRIANGLE = new DynamicTestsShape( >+ "triangle"); //$NON-NLS-1$ >+ >+ /** >+ * @return the shape >+ */ >+ public static DynamicTestsShape getShape(String value) { >+ if (SQUARE.getShape().equals(value)) { >+ return SQUARE; >+ } else if (CIRCLE.getShape().equals(value)) { >+ return CIRCLE; >+ } else if (TRIANGLE.getShape().equals(value)) { >+ return TRIANGLE; >+ } else if (STAR.getShape().equals(value)) { >+ return STAR; >+ } >+ return null; >+ } >+ >+ private String shape; >+ >+ private DynamicTestsShape(String aShape) { >+ setShape(aShape); >+ } >+ >+ /** >+ * @return the shape >+ */ >+ public String getShape() { >+ return shape; >+ } >+ >+ /** >+ * @param shape >+ * the shape to set >+ */ >+ public void setShape(String aShape) { >+ this.shape = aShape; >+ } >+ >+ public String toString() { >+ return getShape(); >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsTriangleSection.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsTriangleSection.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsTriangleSection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsTriangleSection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,29 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.sections; >+ >+/** >+ * A section for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsTriangleSection extends >+ DynamicTestsAbstractLabelSection { >+ >+ public String getGroup() { >+ return "Shape"; //$NON-NLS-1$ >+ } >+ >+ public String getLabel() { >+ return "A section for triangle elements."; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsAdvancedSectionDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsAdvancedSectionDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsAdvancedSectionDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsAdvancedSectionDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,62 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.section.descriptors; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsElement; >+import org.eclipse.ui.views.properties.tabbed.AbstractSectionDescriptor; >+import org.eclipse.ui.views.properties.tabbed.AdvancedPropertySection; >+import org.eclipse.ui.views.properties.tabbed.ISection; >+import org.eclipse.ui.views.properties.tabbed.ITypeMapper; >+ >+/** >+ * A section descriptor for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsAdvancedSectionDescriptor extends >+ AbstractSectionDescriptor { >+ >+ /** >+ * Constructor for DynamicTestsAdvancedSectionDescriptor. >+ * >+ * @param typeMapper >+ * the optional type mapper for the section. >+ */ >+ public DynamicTestsAdvancedSectionDescriptor(ITypeMapper typeMapper) { >+ super(typeMapper); >+ } >+ >+ public int getEnablesFor() { >+ return 1; >+ } >+ >+ public String getId() { >+ return "AdvancedSection"; //$NON-NLS-1$ >+ } >+ >+ public List getInputTypes() { >+ List list = new ArrayList(); >+ list.add(DynamicTestsElement.class.getCanonicalName()); >+ return list; >+ } >+ >+ public ISection getSectionClass() { >+ return new AdvancedPropertySection(); >+ } >+ >+ public String getTargetTab() { >+ return "AdvancedTab"; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsRedSectionDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsRedSectionDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsRedSectionDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsRedSectionDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,53 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.section.descriptors; >+ >+import org.eclipse.jface.viewers.IFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.filters.DynamicTestsRedSectionFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections.DynamicTestsRedSection; >+import org.eclipse.ui.views.properties.tabbed.AbstractSectionDescriptor; >+import org.eclipse.ui.views.properties.tabbed.ISection; >+import org.eclipse.ui.views.properties.tabbed.ITypeMapper; >+ >+/** >+ * A section descriptor for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsRedSectionDescriptor extends AbstractSectionDescriptor { >+ >+ /** >+ * Constructor for DynamicTestsRedSectionDescriptor. >+ * >+ * @param typeMapper >+ * the optional type mapper for the section. >+ */ >+ public DynamicTestsRedSectionDescriptor(ITypeMapper typeMapper) { >+ super(typeMapper); >+ } >+ >+ public IFilter getFilter() { >+ return new DynamicTestsRedSectionFilter(); >+ } >+ >+ public String getId() { >+ return "DynamicTestsRedSection"; //$NON-NLS-1$ >+ } >+ >+ public ISection getSectionClass() { >+ return new DynamicTestsRedSection(); >+ } >+ >+ public String getTargetTab() { >+ return "ColorTab"; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsTitleBarLabelProvider.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsTitleBarLabelProvider.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsTitleBarLabelProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsTitleBarLabelProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,53 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.views; >+ >+import org.eclipse.core.runtime.Assert; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.StructuredSelection; >+import org.eclipse.jface.viewers.TreeNode; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsElement; >+ >+/** >+ * Label provider for the title bar for the tabbed property view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsTitleBarLabelProvider extends >+ org.eclipse.jface.viewers.LabelProvider { >+ >+ public Image getImage(Object obj) { >+ Assert.isTrue(obj instanceof IStructuredSelection); >+ IStructuredSelection structuredSelection = (IStructuredSelection) obj; >+ if (structuredSelection.equals(StructuredSelection.EMPTY) || >+ structuredSelection.size() > 1) { >+ return null; >+ } >+ DynamicTestsElement dynamicTestsElement = (DynamicTestsElement) ((DynamicTestsTreeNode) structuredSelection >+ .getFirstElement()).getValue(); >+ return dynamicTestsElement.getImage(); >+ } >+ >+ public String getText(Object obj) { >+ Assert.isTrue(obj instanceof IStructuredSelection); >+ IStructuredSelection structuredSelection = (IStructuredSelection) obj; >+ if (structuredSelection.equals(StructuredSelection.EMPTY)) { >+ return null; >+ } >+ if (structuredSelection.size() > 1) { >+ return structuredSelection.size() + " items selected";//$NON-NLS-1$ >+ } >+ DynamicTestsElement dynamicTestsElement = (DynamicTestsElement) ((TreeNode) structuredSelection >+ .getFirstElement()).getValue(); >+ return dynamicTestsElement.getName(); >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsTriangleSectionDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsTriangleSectionDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsTriangleSectionDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsTriangleSectionDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,54 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.section.descriptors; >+ >+import org.eclipse.jface.viewers.IFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.filters.DynamicTestsTriangleSectionFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections.DynamicTestsTriangleSection; >+import org.eclipse.ui.views.properties.tabbed.AbstractSectionDescriptor; >+import org.eclipse.ui.views.properties.tabbed.ISection; >+import org.eclipse.ui.views.properties.tabbed.ITypeMapper; >+ >+/** >+ * A section descriptor for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsTriangleSectionDescriptor extends >+ AbstractSectionDescriptor { >+ >+ /** >+ * Constructor for DynamicTestsTriangleSectionDescriptor. >+ * >+ * @param typeMapper >+ * the optional type mapper for the section. >+ */ >+ public DynamicTestsTriangleSectionDescriptor(ITypeMapper typeMapper) { >+ super(typeMapper); >+ } >+ >+ public IFilter getFilter() { >+ return new DynamicTestsTriangleSectionFilter(); >+ } >+ >+ public String getId() { >+ return "DynamicTestsTriangleSection"; //$NON-NLS-1$ >+ } >+ >+ public ISection getSectionClass() { >+ return new DynamicTestsTriangleSection(); >+ } >+ >+ public String getTargetTab() { >+ return "ShapeTab"; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsBlackSectionDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsBlackSectionDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsBlackSectionDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsBlackSectionDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,54 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.section.descriptors; >+ >+import org.eclipse.jface.viewers.IFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.filters.DynamicTestsBlackSectionFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections.DynamicTestsBlackSection; >+import org.eclipse.ui.views.properties.tabbed.AbstractSectionDescriptor; >+import org.eclipse.ui.views.properties.tabbed.ISection; >+import org.eclipse.ui.views.properties.tabbed.ITypeMapper; >+ >+/** >+ * A section descriptor for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsBlackSectionDescriptor extends >+ AbstractSectionDescriptor { >+ >+ /** >+ * Constructor for DynamicTestsBlackSectionDescriptor. >+ * >+ * @param typeMapper >+ * the optional type mapper for the section. >+ */ >+ public DynamicTestsBlackSectionDescriptor(ITypeMapper typeMapper) { >+ super(typeMapper); >+ } >+ >+ public IFilter getFilter() { >+ return new DynamicTestsBlackSectionFilter(); >+ } >+ >+ public String getId() { >+ return "DynamicTestsBlackSection"; //$NON-NLS-1$ >+ } >+ >+ public ISection getSectionClass() { >+ return new DynamicTestsBlackSection(); >+ } >+ >+ public String getTargetTab() { >+ return "BlackTab"; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsBlueSectionFilter.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsBlueSectionFilter.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsBlueSectionFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsBlueSectionFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,26 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.filters; >+ >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsColor; >+ >+/** >+ * A section filter for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsBlueSectionFilter extends >+ DynamicTestsElementSectionFilter { >+ >+ protected boolean appliesToColor(DynamicTestsColor color) { >+ return DynamicTestsColor.BLUE.equals(color); >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsTabDescriptorProvider.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsTabDescriptorProvider.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsTabDescriptorProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsTabDescriptorProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,35 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.tab.descriptors; >+ >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.views.properties.tabbed.ITabDescriptor; >+import org.eclipse.ui.views.properties.tabbed.ITabDescriptorProvider; >+ >+/** >+ * A tab descriptor provider for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsTabDescriptorProvider implements >+ ITabDescriptorProvider { >+ >+ public ITabDescriptor[] getTabDescriptors(IWorkbenchPart part, >+ ISelection selection) { >+ return new ITabDescriptor[] { new DynamicTestsElementTabDescriptor(), >+ new DynamicTestsShapeTabDescriptor(), >+ new DynamicTestsColorTabDescriptor(), >+ new DynamicTestsAdvancedTabDescriptor(), >+ new DynamicTestsBlackTabDescriptor() }; >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsElementSectionFilter.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsElementSectionFilter.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsElementSectionFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsElementSectionFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,63 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.filters; >+ >+import org.eclipse.core.runtime.Assert; >+import org.eclipse.jface.viewers.IFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsColor; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsElement; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsShape; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsTreeNode; >+ >+/** >+ * A section filter for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsElementSectionFilter implements IFilter { >+ >+ /** >+ * Determine if the filter applies to the provided color. >+ * >+ * @param element >+ * the element. >+ * @return true if the filter applies to the provided color. >+ */ >+ protected boolean appliesToColor(DynamicTestsColor color) { >+ Assert.isNotNull(color); >+ return true; >+ } >+ >+ /** >+ * Determine if the filter applies to the provided shape. >+ * >+ * @param element >+ * the element. >+ * @return true if the filter applies to the provided shape. >+ */ >+ protected boolean appliesToShape(DynamicTestsShape shape) { >+ Assert.isNotNull(shape); >+ return true; >+ } >+ >+ public boolean select(Object object) { >+ if (object instanceof DynamicTestsTreeNode) { >+ DynamicTestsElement element = ((DynamicTestsTreeNode) object) >+ .getDynamicTestsElement(); >+ DynamicTestsColor color = (DynamicTestsColor) element >+ .getPropertyValue(DynamicTestsElement.ID_COLOR); >+ DynamicTestsShape shape = (DynamicTestsShape) element >+ .getPropertyValue(DynamicTestsElement.ID_SHAPE); >+ return (appliesToColor(color) && appliesToShape(shape)); >+ } >+ return false; >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsBlueSection.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsBlueSection.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsBlueSection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsBlueSection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,28 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.sections; >+ >+/** >+ * A section for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsBlueSection extends DynamicTestsAbstractLabelSection { >+ >+ public String getGroup() { >+ return "Color"; //$NON-NLS-1$ >+ } >+ >+ public String getLabel() { >+ return "A section for blue elements."; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsTabDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsTabDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsTabDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsTabDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,41 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.text; >+ >+import org.eclipse.ui.views.properties.tabbed.AbstractTabDescriptor; >+ >+/** >+ * A tab descriptor for the text test view. >+ * >+ * @author Anthony Hunter >+ */ >+public class TextTestsTabDescriptor extends AbstractTabDescriptor { >+ >+ private String word; >+ >+ public TextTestsTabDescriptor(String aWord) { >+ super(); >+ this.word = aWord; >+ getSectionDescriptors().add(new TextTestsSectionDescriptor(aWord)); >+ } >+ >+ public String getCategory() { >+ return "default"; //$NON-NLS-1$ >+ } >+ >+ public String getId() { >+ return word; >+ } >+ >+ public String getLabel() { >+ return word; >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsLabelProvider.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsLabelProvider.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsLabelProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsLabelProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,58 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.text; >+ >+import java.util.StringTokenizer; >+ >+import org.eclipse.jface.text.ITextSelection; >+import org.eclipse.jface.viewers.LabelProvider; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.ui.ISharedImages; >+import org.eclipse.ui.PlatformUI; >+ >+/** >+ * Label provider for the title bar for the tabbed property view. >+ * >+ * @author Anthony Hunter >+ */ >+public class TextTestsLabelProvider extends LabelProvider { >+ >+ /** >+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) >+ */ >+ public Image getImage(Object obj) { >+ return PlatformUI.getWorkbench().getSharedImages().getImage( >+ ISharedImages.IMG_OBJ_FILE); >+ } >+ >+ /** >+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) >+ */ >+ public String getText(Object obj) { >+ if (obj instanceof ITextSelection) { >+ ITextSelection textSelection = (ITextSelection) obj; >+ if (textSelection.getLength() != 0) { >+ StringTokenizer tokenizer = new StringTokenizer(textSelection >+ .getText()); >+ int size = 0; >+ while (tokenizer.hasMoreTokens()) { >+ size++; >+ tokenizer.nextToken(); >+ } >+ if (size == 1) { >+ return textSelection.getText(); >+ } >+ return size + " words selected";//$NON-NLS-1$ >+ } >+ } >+ return null; >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsElementSection.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsElementSection.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsElementSection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsElementSection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,29 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.sections; >+ >+/** >+ * A section for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsElementSection extends >+ DynamicTestsAbstractLabelSection { >+ >+ public String getGroup() { >+ return "Element"; //$NON-NLS-1$ >+ } >+ >+ public String getLabel() { >+ return "A section for any element."; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsTreeNode.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsTreeNode.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsTreeNode.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsTreeNode.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,43 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.views; >+ >+import org.eclipse.jface.viewers.TreeNode; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsElement; >+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor; >+ >+/** >+ * A nodes in the tree of the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ * @since 3.4 >+ */ >+public class DynamicTestsTreeNode extends TreeNode implements >+ ITabbedPropertySheetPageContributor { >+ >+ public DynamicTestsTreeNode(Object object) { >+ super(object); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor#getContributorId() >+ */ >+ public String getContributorId() { >+ return getDynamicTestsElement().getContributorId(); >+ } >+ >+ public DynamicTestsElement getDynamicTestsElement() { >+ return (DynamicTestsElement) getValue(); >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsStarSectionFilter.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsStarSectionFilter.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsStarSectionFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsStarSectionFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,26 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.filters; >+ >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsShape; >+ >+/** >+ * A section filter for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsStarSectionFilter extends >+ DynamicTestsElementSectionFilter { >+ >+ protected boolean appliesToShape(DynamicTestsShape shape) { >+ return DynamicTestsShape.STAR.equals(shape); >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsSquareSectionDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsSquareSectionDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsSquareSectionDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsSquareSectionDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,54 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.section.descriptors; >+ >+import org.eclipse.jface.viewers.IFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.filters.DynamicTestsSquareSectionFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections.DynamicTestsSquareSection; >+import org.eclipse.ui.views.properties.tabbed.AbstractSectionDescriptor; >+import org.eclipse.ui.views.properties.tabbed.ISection; >+import org.eclipse.ui.views.properties.tabbed.ITypeMapper; >+ >+/** >+ * A section descriptor for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsSquareSectionDescriptor extends >+ AbstractSectionDescriptor { >+ >+ /** >+ * Constructor for DynamicTestsSquareSectionDescriptor. >+ * >+ * @param typeMapper >+ * the optional type mapper for the section. >+ */ >+ public DynamicTestsSquareSectionDescriptor(ITypeMapper typeMapper) { >+ super(typeMapper); >+ } >+ >+ public IFilter getFilter() { >+ return new DynamicTestsSquareSectionFilter(); >+ } >+ >+ public String getId() { >+ return "DynamicTestsSquareSection"; //$NON-NLS-1$ >+ } >+ >+ public ISection getSectionClass() { >+ return new DynamicTestsSquareSection(); >+ } >+ >+ public String getTargetTab() { >+ return "ShapeTab"; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/model/DynamicTestsElement.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/model/DynamicTestsElement.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/model/DynamicTestsElement.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/model/DynamicTestsElement.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,148 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.model; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.core.runtime.Assert; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.ui.tests.views.properties.tabbed.Activator; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsView; >+import org.eclipse.ui.views.properties.IPropertyDescriptor; >+import org.eclipse.ui.views.properties.IPropertySource; >+import org.eclipse.ui.views.properties.PropertyDescriptor; >+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor; >+ >+/** >+ * An element for the dynamic tests view. We build an element for one of the >+ * icons. For example, "icons/blue_circle.gif" becomes a "Blue Circle" element. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsElement implements >+ ITabbedPropertySheetPageContributor, IPropertySource { >+ >+ public static String ADVANCED_CATEGORY = "Advanced"; //$NON-NLS-1$ >+ >+ public static String DEFAULT_CATEGORY = "Default"; //$NON-NLS-1$ >+ >+ public static String ID_COLOR = "Color"; //$NON-NLS-1$ >+ >+ public static String ID_IMAGE = "Image"; //$NON-NLS-1$ >+ >+ public static String ID_NAME = "Name"; //$NON-NLS-1$ >+ >+ public static String ID_SHAPE = "Shape"; //$NON-NLS-1$ >+ >+ private DynamicTestsColor dynamicTestsColor; >+ >+ private Image image; >+ >+ private String name; >+ >+ private String path; >+ >+ private List propertyDescriptors = new ArrayList(); >+ >+ private DynamicTestsShape shape; >+ >+ private DynamicTestsView view; >+ >+ public DynamicTestsElement(DynamicTestsView aView, String aPath) { >+ super(); >+ this.view = aView; >+ this.path = aPath; >+ int slash = path.indexOf('/'); >+ Assert.isTrue(slash > 0); >+ int underscore = path.indexOf('_'); >+ Assert.isTrue(underscore > 0); >+ int dot = path.indexOf('.'); >+ Assert.isTrue(dot > 0); >+ this.shape = DynamicTestsShape.getShape(path.substring(underscore + 1, >+ dot)); >+ this.dynamicTestsColor = DynamicTestsColor.getColor(path.substring( >+ slash + 1, underscore)); >+ this.image = Activator.getImageDescriptor(path).createImage(); >+ StringBuffer nameBuffer = new StringBuffer(path); >+ nameBuffer.replace(slash + 1, slash + 2, path.substring(slash + 1, >+ slash + 2).toUpperCase()); >+ nameBuffer.replace(underscore + 1, underscore + 2, path.substring( >+ underscore + 1, underscore + 2).toUpperCase()); >+ nameBuffer.replace(underscore, underscore + 1, " ");//$NON-NLS-1$ >+ name = nameBuffer.substring(slash + 1, dot).toString(); >+ PropertyDescriptor propertyDescriptor = new PropertyDescriptor(ID_NAME, >+ ID_NAME); >+ propertyDescriptor.setCategory(DEFAULT_CATEGORY); >+ propertyDescriptors.add(propertyDescriptor); >+ propertyDescriptor = new PropertyDescriptor(ID_COLOR, ID_COLOR); >+ propertyDescriptor.setCategory(DEFAULT_CATEGORY); >+ propertyDescriptors.add(propertyDescriptor); >+ propertyDescriptor = new PropertyDescriptor(ID_SHAPE, ID_SHAPE); >+ propertyDescriptor.setCategory(DEFAULT_CATEGORY); >+ propertyDescriptors.add(propertyDescriptor); >+ propertyDescriptor = new PropertyDescriptor(ID_IMAGE, ID_IMAGE); >+ propertyDescriptor.setCategory(ADVANCED_CATEGORY); >+ propertyDescriptors.add(propertyDescriptor); >+ } >+ >+ public String getContributorId() { >+ return view.getContributorId(); >+ } >+ >+ public Object getEditableValue() { >+ return this; >+ } >+ >+ /** >+ * @return the image >+ */ >+ public Image getImage() { >+ return image; >+ } >+ >+ /** >+ * @return the name >+ */ >+ public String getName() { >+ return name; >+ } >+ >+ public IPropertyDescriptor[] getPropertyDescriptors() { >+ return (IPropertyDescriptor[]) propertyDescriptors >+ .toArray(new IPropertyDescriptor[0]); >+ } >+ >+ public Object getPropertyValue(Object id) { >+ if (id.equals(ID_COLOR)) { >+ return dynamicTestsColor; >+ } else if (id.equals(ID_SHAPE)) { >+ return shape; >+ } else if (id.equals(ID_NAME)) { >+ return name; >+ } else if (id.equals(ID_IMAGE)) { >+ return path; >+ } >+ return null; >+ } >+ >+ public boolean isPropertySet(Object id) { >+ return true; >+ } >+ >+ public void resetPropertyValue(Object id) { >+ // Not implemented, read only properties >+ } >+ >+ public void setPropertyValue(Object id, Object value) { >+ // Not implemented, read only properties >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsTriangleSectionFilter.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsTriangleSectionFilter.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsTriangleSectionFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsTriangleSectionFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,26 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.filters; >+ >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsShape; >+ >+/** >+ * A section filter for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsTriangleSectionFilter extends >+ DynamicTestsElementSectionFilter { >+ >+ protected boolean appliesToShape(DynamicTestsShape shape) { >+ return DynamicTestsShape.TRIANGLE.equals(shape); >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageDynamicTest.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageDynamicTest.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageDynamicTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageDynamicTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,412 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import junit.framework.TestCase; >+ >+import org.eclipse.jface.viewers.IContentProvider; >+import org.eclipse.jface.viewers.StructuredSelection; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.ui.IViewPart; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyComposite; >+import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyList; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsColor; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsElement; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsShape; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsTreeNode; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsView; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsViewContentProvider; >+import org.eclipse.ui.tests.views.properties.tabbed.views.TestsPerspective; >+ >+/** >+ * Tests for the dynamic tab and section support. >+ * >+ * @author Anthony Hunter >+ * @since 3.4 >+ */ >+public class TabbedPropertySheetPageDynamicTest extends TestCase { >+ >+ private DynamicTestsView dynamicTestsView; >+ >+ private DynamicTestsTreeNode[] treeNodes; >+ >+ protected void setUp() throws Exception { >+ super.setUp(); >+ >+ /** >+ * Close the existing perspectives. >+ */ >+ IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench() >+ .getActiveWorkbenchWindow(); >+ assertNotNull(workbenchWindow); >+ IWorkbenchPage workbenchPage = workbenchWindow.getActivePage(); >+ assertNotNull(workbenchPage); >+ workbenchPage.closeAllPerspectives(false, false); >+ >+ /** >+ * Open the tests perspective. >+ */ >+ PlatformUI.getWorkbench().showPerspective( >+ TestsPerspective.TESTS_PERSPECTIVE_ID, workbenchWindow); >+ >+ /** >+ * Open the dynamic tests view. >+ */ >+ IViewPart view = workbenchPage >+ .showView(DynamicTestsView.DYNAMIC_TESTS_VIEW_ID); >+ assertNotNull(view); >+ assertTrue(view instanceof DynamicTestsView); >+ dynamicTestsView = (DynamicTestsView) view; >+ >+ /** >+ * get the list of tree nodes from the view. >+ */ >+ IContentProvider contentProvider = dynamicTestsView.getViewer() >+ .getContentProvider(); >+ assertTrue(contentProvider instanceof DynamicTestsViewContentProvider); >+ DynamicTestsViewContentProvider viewContentProvider = (DynamicTestsViewContentProvider) contentProvider; >+ treeNodes = (DynamicTestsTreeNode[]) viewContentProvider >+ .getInvisibleRoot().getChildren(); >+ assertEquals(treeNodes.length, 11); >+ } >+ >+ protected void tearDown() throws Exception { >+ super.tearDown(); >+ >+ /** >+ * Bug 175070: Make sure the views have finished painting. >+ */ >+ while (Display.getCurrent().readAndDispatch()) { >+ // >+ } >+ >+ /** >+ * Deselect everything in the Tests view. >+ */ >+ setSelection(new DynamicTestsTreeNode[] {}); >+ } >+ >+ /** >+ * Set the selection in the view to cause the properties view to change. >+ * >+ * @param selectedNodes >+ * nodes to select in the view. >+ */ >+ private void setSelection(DynamicTestsTreeNode[] selectedNodes) { >+ StructuredSelection selection = new StructuredSelection(selectedNodes); >+ dynamicTestsView.getViewer().setSelection(selection, true); >+ } >+ >+ /** >+ * Get the list of tabs from the tabbed properties view. >+ * >+ * @return the tab list. >+ */ >+ private TabbedPropertyList getTabbedPropertyList() { >+ Control control = dynamicTestsView.getTabbedPropertySheetPage() >+ .getControl(); >+ assertTrue(control instanceof TabbedPropertyComposite); >+ TabbedPropertyComposite tabbedPropertyComposite = (TabbedPropertyComposite) control; >+ return tabbedPropertyComposite.getList(); >+ } >+ >+ /** >+ * When the three blue nodes are selected, two tabs display. >+ */ >+ public void test_BlueStaticContribution() { >+ dynamicTestsView >+ .setContributorId(DynamicTestsView.DYNAMIC_TESTS_VIEW_STATIC); >+ select_all_blue(); >+ } >+ >+ /** >+ * When the three blue nodes are selected, two tabs display. >+ */ >+ public void test_BlueDynamicTabContribution() { >+ dynamicTestsView >+ .setContributorId(DynamicTestsView.DYNAMIC_TESTS_VIEW_DYNAMIC_TABS); >+ select_all_blue(); >+ } >+ >+ /** >+ * When the three blue nodes are selected, two tabs display. >+ */ >+ public void test_BlueDynamicSectionContribution() { >+ dynamicTestsView >+ .setContributorId(DynamicTestsView.DYNAMIC_TESTS_VIEW_DYNAMIC_SECTIONS); >+ select_all_blue(); >+ } >+ >+ /** >+ * When the three blue nodes are selected, two tabs display. >+ */ >+ public void select_all_blue() { >+ List blueList = new ArrayList(); >+ for (int i = 0; i < treeNodes.length; i++) { >+ if (DynamicTestsColor.BLUE.equals(treeNodes[i] >+ .getDynamicTestsElement().getPropertyValue( >+ DynamicTestsElement.ID_COLOR))) { >+ blueList.add(treeNodes[i]); >+ } >+ } >+ DynamicTestsTreeNode[] selectNodes = (DynamicTestsTreeNode[]) blueList >+ .toArray(new DynamicTestsTreeNode[blueList.size()]); >+ assertEquals(blueList.size(), 3); >+ >+ setSelection(selectNodes); >+ >+ TabbedPropertyList tabbedPropertyList = getTabbedPropertyList(); >+ /** >+ * First tab is Element >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(0).toString(), "Element");//$NON-NLS-1$ >+ /** >+ * Second tab is Color >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(1).toString(), "Color");//$NON-NLS-1$ >+ /** >+ * No other tab >+ */ >+ assertNull(tabbedPropertyList.getElementAt(2)); >+ } >+ >+ /** >+ * When the three triangle nodes are selected, two tabs display. >+ */ >+ public void test_TriangleStaticContribution() { >+ dynamicTestsView >+ .setContributorId(DynamicTestsView.DYNAMIC_TESTS_VIEW_STATIC); >+ select_all_triangle(); >+ } >+ >+ /** >+ * When the three triangle nodes are selected, two tabs display. >+ */ >+ public void test_TriangleDynamicTabContribution() { >+ dynamicTestsView >+ .setContributorId(DynamicTestsView.DYNAMIC_TESTS_VIEW_DYNAMIC_TABS); >+ select_all_triangle(); >+ } >+ >+ /** >+ * When the three triangle nodes are selected, two tabs display. >+ */ >+ public void test_TriangleDynamicSectionContribution() { >+ dynamicTestsView >+ .setContributorId(DynamicTestsView.DYNAMIC_TESTS_VIEW_DYNAMIC_SECTIONS); >+ select_all_triangle(); >+ } >+ >+ /** >+ * When the three triangle nodes are selected, two tabs display. >+ */ >+ public void select_all_triangle() { >+ List triangleList = new ArrayList(); >+ for (int i = 0; i < treeNodes.length; i++) { >+ if (DynamicTestsShape.TRIANGLE.equals(treeNodes[i] >+ .getDynamicTestsElement().getPropertyValue( >+ DynamicTestsElement.ID_SHAPE))) { >+ triangleList.add(treeNodes[i]); >+ } >+ } >+ DynamicTestsTreeNode[] selectNodes = (DynamicTestsTreeNode[]) triangleList >+ .toArray(new DynamicTestsTreeNode[triangleList.size()]); >+ assertEquals(triangleList.size(), 4); >+ >+ setSelection(selectNodes); >+ >+ TabbedPropertyList tabbedPropertyList = getTabbedPropertyList(); >+ /** >+ * First tab is Element >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(0).toString(), "Element");//$NON-NLS-1$ >+ /** >+ * Second tab is Shape >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(1).toString(), "Shape");//$NON-NLS-1$ >+ /** >+ * No other tab >+ */ >+ assertNull(tabbedPropertyList.getElementAt(2)); >+ } >+ >+ /** >+ * When the black triangle is selected, three tabs display. >+ */ >+ public void test_BlackTriangleStaticContribution() { >+ dynamicTestsView >+ .setContributorId(DynamicTestsView.DYNAMIC_TESTS_VIEW_STATIC); >+ select_blackTriangle(); >+ TabbedPropertyList tabbedPropertyList = getTabbedPropertyList(); >+ /** >+ * Only three tabs displayed for static contribution. >+ */ >+ assertNull(tabbedPropertyList.getElementAt(3)); >+ } >+ >+ /** >+ * When the black triangle is selected, four tabs display. >+ */ >+ public void test_BlackTriangleDynamicTabContribution() { >+ dynamicTestsView >+ .setContributorId(DynamicTestsView.DYNAMIC_TESTS_VIEW_DYNAMIC_TABS); >+ select_blackTriangle(); >+ TabbedPropertyList tabbedPropertyList = getTabbedPropertyList(); >+ /** >+ * Fourth tab is Black >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(3).toString(), "Black");//$NON-NLS-1$ >+ /** >+ * No other tab >+ */ >+ assertNull(tabbedPropertyList.getElementAt(4)); >+ } >+ >+ /** >+ * When the black triangle is selected, three tabs display. >+ */ >+ public void test_BlackTriangleDynamicSectionContribution() { >+ dynamicTestsView >+ .setContributorId(DynamicTestsView.DYNAMIC_TESTS_VIEW_DYNAMIC_SECTIONS); >+ select_blackTriangle(); >+ TabbedPropertyList tabbedPropertyList = getTabbedPropertyList(); >+ /** >+ * Only three tabs displayed for dynamic section contribution. >+ */ >+ assertNull(tabbedPropertyList.getElementAt(3)); >+ } >+ >+ /** >+ * When the black triangle is selected, four tabs display. >+ */ >+ public void select_blackTriangle() { >+ DynamicTestsTreeNode blackTriangleNode = null; >+ for (int i = 0; i < treeNodes.length; i++) { >+ if (DynamicTestsColor.BLACK.equals(treeNodes[i] >+ .getDynamicTestsElement().getPropertyValue( >+ DynamicTestsElement.ID_COLOR))) { >+ blackTriangleNode = treeNodes[i]; >+ break; >+ } >+ } >+ assertNotNull(blackTriangleNode); >+ >+ setSelection(new DynamicTestsTreeNode[] { blackTriangleNode }); >+ >+ TabbedPropertyList tabbedPropertyList = getTabbedPropertyList(); >+ /** >+ * First tab is Element >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(0).toString(), "Element");//$NON-NLS-1$ >+ /** >+ * Second tab is Shape >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(1).toString(), "Shape");//$NON-NLS-1$ >+ /** >+ * Third tab is Advanced >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(2).toString(), "Advanced");//$NON-NLS-1$ >+ } >+ >+ /** >+ * When the red star is selected, three tabs display. >+ */ >+ public void test_RedStarStaticContribution() { >+ dynamicTestsView >+ .setContributorId(DynamicTestsView.DYNAMIC_TESTS_VIEW_STATIC); >+ select_RedStar(); >+ TabbedPropertyList tabbedPropertyList = getTabbedPropertyList(); >+ /** >+ * Third tab is Advanced >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(2).toString(), "Advanced");//$NON-NLS-1$ >+ /** >+ * Only three tabs displayed for static contribution. >+ */ >+ assertNull(tabbedPropertyList.getElementAt(3)); >+ } >+ >+ /** >+ * When the red star is selected, four tabs display. >+ */ >+ public void test_RedStarDynamicTabContribution() { >+ dynamicTestsView >+ .setContributorId(DynamicTestsView.DYNAMIC_TESTS_VIEW_DYNAMIC_TABS); >+ select_RedStar(); >+ TabbedPropertyList tabbedPropertyList = getTabbedPropertyList(); >+ /** >+ * Third tab is Advanced >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(2).toString(), "Advanced");//$NON-NLS-1$ >+ /** >+ * Only three tabs displayed for dynamic tab contribution. >+ */ >+ assertNull(tabbedPropertyList.getElementAt(3)); >+ } >+ >+ /** >+ * When the red star is selected, three tabs display. >+ */ >+ public void test_RedStarDynamicSectionContribution() { >+ dynamicTestsView >+ .setContributorId(DynamicTestsView.DYNAMIC_TESTS_VIEW_DYNAMIC_SECTIONS); >+ select_RedStar(); >+ TabbedPropertyList tabbedPropertyList = getTabbedPropertyList(); >+ /** >+ * Third tab is Star >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(2).toString(), "Star");//$NON-NLS-1$ >+ /** >+ * Fourth tab is Advanced >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(3).toString(), "Advanced");//$NON-NLS-1$ >+ /** >+ * No other tab >+ */ >+ assertNull(tabbedPropertyList.getElementAt(4)); >+ } >+ >+ /** >+ * When the red star is selected, four tabs display. >+ */ >+ public void select_RedStar() { >+ DynamicTestsTreeNode redStarNode = null; >+ for (int i = 0; i < treeNodes.length; i++) { >+ if (DynamicTestsShape.STAR.equals(treeNodes[i] >+ .getDynamicTestsElement().getPropertyValue( >+ DynamicTestsElement.ID_SHAPE))) { >+ redStarNode = treeNodes[i]; >+ break; >+ } >+ } >+ assertNotNull(redStarNode); >+ >+ setSelection(new DynamicTestsTreeNode[] { redStarNode }); >+ >+ TabbedPropertyList tabbedPropertyList = getTabbedPropertyList(); >+ /** >+ * First tab is Element >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(0).toString(), "Element");//$NON-NLS-1$ >+ /** >+ * Second tab is Color >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(1).toString(), "Color");//$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsViewContentProvider.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsViewContentProvider.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsViewContentProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsViewContentProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,97 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.views; >+ >+import org.eclipse.jface.viewers.IStructuredContentProvider; >+import org.eclipse.jface.viewers.ITreeContentProvider; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsElement; >+ >+/** >+ * A content provider for nodes in the tree of the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsViewContentProvider implements >+ IStructuredContentProvider, ITreeContentProvider { >+ >+ private DynamicTestsTreeNode invisibleRoot; >+ >+ private final DynamicTestsView view; >+ >+ public DynamicTestsViewContentProvider(DynamicTestsView dynamicTestsView) { >+ super(); >+ this.view = dynamicTestsView; >+ } >+ >+ public void dispose() { >+ // >+ } >+ >+ public Object[] getChildren(Object parent) { >+ if (parent instanceof DynamicTestsTreeNode) { >+ return ((DynamicTestsTreeNode) parent).getChildren(); >+ } >+ return new Object[0]; >+ } >+ >+ public Object[] getElements(Object parent) { >+ if (parent.equals(this.view.getViewSite())) { >+ if (invisibleRoot == null) >+ initialize(); >+ return getChildren(invisibleRoot); >+ } >+ return getChildren(parent); >+ } >+ >+ public DynamicTestsTreeNode getInvisibleRoot() { >+ return invisibleRoot; >+ } >+ >+ public Object getParent(Object child) { >+ if (child instanceof DynamicTestsTreeNode) { >+ return ((DynamicTestsTreeNode) child).getParent(); >+ } >+ return null; >+ } >+ >+ public boolean hasChildren(Object parent) { >+ if (parent instanceof DynamicTestsTreeNode) >+ return ((DynamicTestsTreeNode) parent).hasChildren(); >+ return false; >+ } >+ >+ public void initialize() { >+ String elements[] = new String[] { "icons/black_triangle.gif",//$NON-NLS-1$ >+ "icons/blue_circle.gif",//$NON-NLS-1$ >+ "icons/blue_square.gif",//$NON-NLS-1$ >+ "icons/blue_triangle.gif",//$NON-NLS-1$ >+ "icons/green_circle.gif",//$NON-NLS-1$ >+ "icons/green_square.gif",//$NON-NLS-1$ >+ "icons/green_triangle.gif",//$NON-NLS-1$ >+ "icons/red_circle.gif",//$NON-NLS-1$ >+ "icons/red_square.gif",//$NON-NLS-1$ >+ "icons/red_star.gif",//$NON-NLS-1$ >+ "icons/red_triangle.gif" };//$NON-NLS-1$ >+ DynamicTestsTreeNode[] nodes = new DynamicTestsTreeNode[elements.length]; >+ for (int i = 0; i < elements.length; i++) { >+ DynamicTestsElement dynamicTestsElement = new DynamicTestsElement( >+ view, elements[i]); >+ nodes[i] = new DynamicTestsTreeNode(dynamicTestsElement); >+ } >+ invisibleRoot = new DynamicTestsTreeNode(null); >+ invisibleRoot.setChildren(nodes); >+ } >+ >+ public void inputChanged(Viewer v, Object oldInput, Object newInput) { >+ // >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsStarSection.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsStarSection.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsStarSection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsStarSection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,28 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.sections; >+ >+/** >+ * A section for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsStarSection extends DynamicTestsAbstractLabelSection { >+ >+ public String getGroup() { >+ return "Star"; //$NON-NLS-1$ >+ } >+ >+ public String getLabel() { >+ return "A section for star elements."; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsAbstractLabelSection.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsAbstractLabelSection.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsAbstractLabelSection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsAbstractLabelSection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,66 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.sections; >+ >+import org.eclipse.swt.custom.CLabel; >+import org.eclipse.swt.layout.FormAttachment; >+import org.eclipse.swt.layout.FormData; >+import org.eclipse.swt.layout.FormLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Group; >+import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection; >+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; >+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; >+ >+/** >+ * An abstract section for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public abstract class DynamicTestsAbstractLabelSection extends >+ AbstractPropertySection { >+ >+ public void createControls(Composite parent, >+ TabbedPropertySheetPage aTabbedPropertySheetPage) { >+ super.createControls(parent, aTabbedPropertySheetPage); >+ Composite composite = getWidgetFactory() >+ .createFlatFormComposite(parent); >+ >+ Group group = getWidgetFactory().createGroup(composite, getGroup()); >+ FormLayout layout = new FormLayout(); >+ layout.marginWidth = ITabbedPropertyConstants.HSPACE + 2; >+ layout.marginHeight = ITabbedPropertyConstants.VSPACE; >+ layout.spacing = ITabbedPropertyConstants.VMARGIN + 1; >+ group.setLayout(layout); >+ FormData data = new FormData(); >+ data.left = new FormAttachment(0, 0); >+ data.right = new FormAttachment(100, 0); >+ data.top = new FormAttachment(0, 0); >+ data.bottom = new FormAttachment(100, 0); >+ group.setLayoutData(data); >+ >+ CLabel nameLabel = getWidgetFactory().createCLabel(group, getLabel()); >+ data = new FormData(); >+ data.left = new FormAttachment(0, 0); >+ data.right = new FormAttachment(100, 0); >+ data.top = new FormAttachment(0, 0); >+ nameLabel.setLayoutData(data); >+ } >+ >+ public abstract String getGroup(); >+ >+ public abstract String getLabel(); >+ >+ public boolean shouldUseExtraSpace() { >+ return true; >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsShapeTabDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsShapeTabDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsShapeTabDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsShapeTabDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,55 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.tab.descriptors; >+ >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.section.descriptors.DynamicTestsCircleSectionDescriptor; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.section.descriptors.DynamicTestsSquareSectionDescriptor; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.section.descriptors.DynamicTestsTriangleSectionDescriptor; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsTypeMapper; >+import org.eclipse.ui.views.properties.tabbed.AbstractTabDescriptor; >+ >+/** >+ * A tab descriptor for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsShapeTabDescriptor extends AbstractTabDescriptor { >+ >+ public DynamicTestsShapeTabDescriptor() { >+ super(); >+ getSectionDescriptors().add( >+ new DynamicTestsCircleSectionDescriptor( >+ new DynamicTestsTypeMapper())); >+ getSectionDescriptors().add( >+ new DynamicTestsSquareSectionDescriptor( >+ new DynamicTestsTypeMapper())); >+ getSectionDescriptors().add( >+ new DynamicTestsTriangleSectionDescriptor( >+ new DynamicTestsTypeMapper())); >+ } >+ >+ public String getAfterTab() { >+ return "ColorTab"; //$NON-NLS-1$ >+ } >+ >+ public String getCategory() { >+ return "default"; //$NON-NLS-1$ >+ } >+ >+ public String getId() { >+ return "ShapeTab"; //$NON-NLS-1$ >+ } >+ >+ public String getLabel() { >+ return "Shape"; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsStarSectionDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsStarSectionDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsStarSectionDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsStarSectionDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,54 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.section.descriptors; >+ >+import org.eclipse.jface.viewers.IFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.filters.DynamicTestsStarSectionFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections.DynamicTestsStarSection; >+import org.eclipse.ui.views.properties.tabbed.AbstractSectionDescriptor; >+import org.eclipse.ui.views.properties.tabbed.ISection; >+import org.eclipse.ui.views.properties.tabbed.ITypeMapper; >+ >+/** >+ * A section descriptor for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsStarSectionDescriptor extends >+ AbstractSectionDescriptor { >+ >+ /** >+ * Constructor for DynamicTestsStarSectionDescriptor. >+ * >+ * @param typeMapper >+ * the optional type mapper for the section. >+ */ >+ public DynamicTestsStarSectionDescriptor(ITypeMapper typeMapper) { >+ super(typeMapper); >+ } >+ >+ public IFilter getFilter() { >+ return new DynamicTestsStarSectionFilter(); >+ } >+ >+ public String getId() { >+ return "DynamicTestsStarSection"; //$NON-NLS-1$ >+ } >+ >+ public ISection getSectionClass() { >+ return new DynamicTestsStarSection(); >+ } >+ >+ public String getTargetTab() { >+ return "StarTab"; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsCircleSection.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsCircleSection.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsCircleSection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsCircleSection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,28 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.sections; >+ >+/** >+ * A section for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsCircleSection extends DynamicTestsAbstractLabelSection { >+ >+ public String getGroup() { >+ return "Shape"; //$NON-NLS-1$ >+ } >+ >+ public String getLabel() { >+ return "A section for circle elements."; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsSectionDescriptorProvider.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsSectionDescriptorProvider.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsSectionDescriptorProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsSectionDescriptorProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,47 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.section.descriptors; >+ >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsTypeMapper; >+import org.eclipse.ui.views.properties.tabbed.ISectionDescriptor; >+import org.eclipse.ui.views.properties.tabbed.ISectionDescriptorProvider; >+ >+/** >+ * A section descriptor provider for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsSectionDescriptorProvider implements >+ ISectionDescriptorProvider { >+ >+ public ISectionDescriptor[] getSectionDescriptors() { >+ return new ISectionDescriptor[] { >+ new DynamicTestsStarSectionDescriptor( >+ new DynamicTestsTypeMapper()), >+ new DynamicTestsBlueSectionDescriptor( >+ new DynamicTestsTypeMapper()), >+ new DynamicTestsCircleSectionDescriptor( >+ new DynamicTestsTypeMapper()), >+ new DynamicTestsElementSectionDescriptor( >+ new DynamicTestsTypeMapper()), >+ new DynamicTestsGreenSectionDescriptor( >+ new DynamicTestsTypeMapper()), >+ new DynamicTestsAdvancedSectionDescriptor( >+ new DynamicTestsTypeMapper()), >+ new DynamicTestsRedSectionDescriptor( >+ new DynamicTestsTypeMapper()), >+ new DynamicTestsSquareSectionDescriptor( >+ new DynamicTestsTypeMapper()), >+ new DynamicTestsTriangleSectionDescriptor( >+ new DynamicTestsTypeMapper()) }; >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsView.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsView.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsView.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/views/DynamicTestsView.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,205 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.views; >+ >+import org.eclipse.jface.action.Action; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.action.IToolBarManager; >+import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.jface.viewers.LabelProvider; >+import org.eclipse.jface.viewers.StructuredSelection; >+import org.eclipse.jface.viewers.TreeViewer; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.ui.ISharedImages; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.part.ViewPart; >+import org.eclipse.ui.tests.views.properties.tabbed.Activator; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsElement; >+import org.eclipse.ui.views.properties.IPropertySheetPage; >+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor; >+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; >+ >+/** >+ * A view to test dynamic contributions to the tabbed properties view. The view >+ * has three modes of providing tabs and sections to the tabbed properties view: >+ * use static contributions from plugin.xml, use dynamic section contributions >+ * from code, or use dynamic tab (and section) contributions from code. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsView extends ViewPart implements >+ ITabbedPropertySheetPageContributor { >+ >+ class DynamicTestsViewLabelProvider extends LabelProvider { >+ >+ public Image getImage(Object obj) { >+ DynamicTestsElement element = ((DynamicTestsTreeNode) obj) >+ .getDynamicTestsElement(); >+ return element.getImage(); >+ } >+ >+ public String getText(Object obj) { >+ DynamicTestsElement element = ((DynamicTestsTreeNode) obj) >+ .getDynamicTestsElement(); >+ return element.getName(); >+ } >+ } >+ >+ public static final String DYNAMIC_TESTS_VIEW_ID = "org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsView"; //$NON-NLS-1$ >+ >+ public static final String DYNAMIC_TESTS_VIEW_STATIC = "org.eclipse.ui.tests.views.properties.tabbed.static"; //$NON-NLS-1$ >+ >+ public static final String DYNAMIC_TESTS_VIEW_DYNAMIC_TABS = "org.eclipse.ui.tests.views.properties.tabbed.dynamic.tab"; //$NON-NLS-1$ >+ >+ public static final String DYNAMIC_TESTS_VIEW_DYNAMIC_SECTIONS = "org.eclipse.ui.tests.views.properties.tabbed.dynamic.section"; //$NON-NLS-1$ >+ private Action dynamicSectionsAction; >+ >+ private Action dynamicTabsAction; >+ >+ private Action staticAction; >+ >+ private TabbedPropertySheetPage tabbedPropertySheetPage; >+ >+ private TreeViewer viewer; >+ >+ public void createPartControl(Composite parent) { >+ viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); >+ viewer.setContentProvider(new DynamicTestsViewContentProvider(this)); >+ viewer.setLabelProvider(new DynamicTestsViewLabelProvider()); >+ viewer.setInput(getViewSite()); >+ initToolBar(); >+ getSite().setSelectionProvider(viewer); >+ } >+ >+ public Object getAdapter(Class adapter) { >+ if (adapter == IPropertySheetPage.class) { >+ if (tabbedPropertySheetPage == null) { >+ tabbedPropertySheetPage = new TabbedPropertySheetPage(this); >+ } >+ return tabbedPropertySheetPage; >+ } >+ return super.getAdapter(adapter); >+ } >+ >+ public String getContributorId() { >+ if (staticAction.isChecked()) { >+ return DYNAMIC_TESTS_VIEW_STATIC; >+ } else if (dynamicSectionsAction.isChecked()) { >+ return DYNAMIC_TESTS_VIEW_DYNAMIC_SECTIONS; >+ } else if (dynamicTabsAction.isChecked()) { >+ return DYNAMIC_TESTS_VIEW_DYNAMIC_TABS; >+ } else { >+ return null; >+ } >+ } >+ >+ public void setContributorId(String contributorId) { >+ if (DYNAMIC_TESTS_VIEW_STATIC.equals(contributorId)) { >+ staticAction.setChecked(true); >+ dynamicSectionsAction.setChecked(false); >+ dynamicTabsAction.setChecked(false); >+ } else if (DYNAMIC_TESTS_VIEW_DYNAMIC_SECTIONS.equals(contributorId)) { >+ staticAction.setChecked(false); >+ dynamicSectionsAction.setChecked(true); >+ dynamicTabsAction.setChecked(false); >+ } else if (DYNAMIC_TESTS_VIEW_DYNAMIC_TABS.equals(contributorId)) { >+ staticAction.setChecked(false); >+ dynamicSectionsAction.setChecked(false); >+ dynamicTabsAction.setChecked(true); >+ } >+ } >+ >+ public TabbedPropertySheetPage getTabbedPropertySheetPage() { >+ return tabbedPropertySheetPage; >+ } >+ >+ public TreeViewer getViewer() { >+ return viewer; >+ } >+ >+ /** >+ * Create the tool bar for the view. The tool bar has three toggle buttons >+ * which enable one of the three property contributors. >+ */ >+ private void initToolBar() { >+ final String staticText = "Use static contributions from plugin.xml"; //$NON-NLS-1$ >+ final String dynamicSectionsText = "Use dynamic section contributions from code"; //$NON-NLS-1$ >+ final String dynamicTabsText = "Use dynamic tab (and section) contributions from code"; //$NON-NLS-1$ >+ ImageDescriptor imageDescriptor = Activator >+ .getImageDescriptor("icons/sample.gif");//$NON-NLS-1$ >+ if (imageDescriptor == null) { >+ imageDescriptor = PlatformUI.getWorkbench().getSharedImages() >+ .getImageDescriptor(ISharedImages.IMG_OBJS_ERROR_TSK); >+ } >+ >+ staticAction = new Action(staticText, IAction.AS_CHECK_BOX) { >+ public void run() { >+ if (isChecked()) { >+ getViewSite().getActionBars().getStatusLineManager() >+ .setMessage(staticText); >+ dynamicSectionsAction.setChecked(false); >+ dynamicTabsAction.setChecked(false); >+ viewer.setSelection(StructuredSelection.EMPTY); >+ } >+ } >+ }; >+ staticAction.setToolTipText(staticText); >+ staticAction.setImageDescriptor(imageDescriptor); >+ staticAction.setDisabledImageDescriptor(imageDescriptor); >+ >+ dynamicSectionsAction = new Action(dynamicSectionsText, >+ IAction.AS_CHECK_BOX) { >+ public void run() { >+ if (isChecked()) { >+ getViewSite().getActionBars().getStatusLineManager() >+ .setMessage(dynamicSectionsText); >+ staticAction.setChecked(false); >+ dynamicTabsAction.setChecked(false); >+ viewer.setSelection(StructuredSelection.EMPTY); >+ } >+ } >+ }; >+ dynamicSectionsAction.setToolTipText(dynamicSectionsText); >+ dynamicSectionsAction.setImageDescriptor(imageDescriptor); >+ dynamicSectionsAction.setDisabledImageDescriptor(imageDescriptor); >+ >+ dynamicTabsAction = new Action(dynamicTabsText, IAction.AS_CHECK_BOX) { >+ public void run() { >+ if (isChecked()) { >+ getViewSite().getActionBars().getStatusLineManager() >+ .setMessage(dynamicTabsText); >+ staticAction.setChecked(false); >+ dynamicSectionsAction.setChecked(false); >+ viewer.setSelection(StructuredSelection.EMPTY); >+ } >+ } >+ }; >+ dynamicTabsAction.setToolTipText(dynamicTabsText); >+ dynamicTabsAction.setImageDescriptor(imageDescriptor); >+ dynamicTabsAction.setDisabledImageDescriptor(imageDescriptor); >+ staticAction.setChecked(true); >+ >+ IToolBarManager toolBarManager = getViewSite().getActionBars() >+ .getToolBarManager(); >+ toolBarManager.add(staticAction); >+ toolBarManager.add(dynamicSectionsAction); >+ toolBarManager.add(dynamicTabsAction); >+ >+ getViewSite().getActionBars().getStatusLineManager().setMessage( >+ staticText); >+ } >+ >+ public void setFocus() { >+ viewer.getControl().setFocus(); >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsGreenSectionFilter.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsGreenSectionFilter.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsGreenSectionFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsGreenSectionFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,26 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.filters; >+ >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsColor; >+ >+/** >+ * A section filter for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsGreenSectionFilter extends >+ DynamicTestsElementSectionFilter { >+ >+ protected boolean appliesToColor(DynamicTestsColor color) { >+ return DynamicTestsColor.GREEN.equals(color); >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsElementTabDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsElementTabDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsElementTabDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsElementTabDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,43 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.tab.descriptors; >+ >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.section.descriptors.DynamicTestsElementSectionDescriptor; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsTypeMapper; >+import org.eclipse.ui.views.properties.tabbed.AbstractTabDescriptor; >+ >+/** >+ * A tab descriptor for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsElementTabDescriptor extends AbstractTabDescriptor { >+ >+ public DynamicTestsElementTabDescriptor() { >+ super(); >+ getSectionDescriptors().add( >+ new DynamicTestsElementSectionDescriptor( >+ new DynamicTestsTypeMapper())); >+ } >+ >+ public String getCategory() { >+ return "default"; //$NON-NLS-1$ >+ } >+ >+ public String getId() { >+ return "ElementTab"; //$NON-NLS-1$ >+ } >+ >+ public String getLabel() { >+ return "Element"; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsLabelSection.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsLabelSection.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsLabelSection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/text/TextTestsLabelSection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,48 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.text; >+ >+import org.eclipse.swt.custom.CLabel; >+import org.eclipse.swt.layout.FormAttachment; >+import org.eclipse.swt.layout.FormData; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection; >+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; >+ >+/** >+ * A section for the text test view. >+ * >+ * @author Anthony Hunter >+ */ >+public class TextTestsLabelSection extends AbstractPropertySection { >+ >+ protected String label; >+ >+ public TextTestsLabelSection(String word) { >+ super(); >+ label = "A simple section for a selected word \"" + word + "\".";//$NON-NLS-1$//$NON-NLS-2$ >+ } >+ >+ public void createControls(Composite parent, >+ TabbedPropertySheetPage aTabbedPropertySheetPage) { >+ super.createControls(parent, aTabbedPropertySheetPage); >+ Composite composite = getWidgetFactory() >+ .createFlatFormComposite(parent); >+ >+ CLabel nameLabel = getWidgetFactory().createCLabel(composite, label); >+ FormData data = new FormData(); >+ data.left = new FormAttachment(0, 0); >+ data.right = new FormAttachment(100, 0); >+ data.top = new FormAttachment(0, 0); >+ nameLabel.setLayoutData(data); >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsBlueSectionDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsBlueSectionDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsBlueSectionDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsBlueSectionDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,54 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.section.descriptors; >+ >+import org.eclipse.jface.viewers.IFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.filters.DynamicTestsBlueSectionFilter; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections.DynamicTestsBlueSection; >+import org.eclipse.ui.views.properties.tabbed.AbstractSectionDescriptor; >+import org.eclipse.ui.views.properties.tabbed.ISection; >+import org.eclipse.ui.views.properties.tabbed.ITypeMapper; >+ >+/** >+ * A section descriptor for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsBlueSectionDescriptor extends >+ AbstractSectionDescriptor { >+ >+ /** >+ * Constructor for DynamicTestsBlueSectionDescriptor. >+ * >+ * @param typeMapper >+ * the optional type mapper for the section. >+ */ >+ public DynamicTestsBlueSectionDescriptor(ITypeMapper typeMapper) { >+ super(typeMapper); >+ } >+ >+ public IFilter getFilter() { >+ return new DynamicTestsBlueSectionFilter(); >+ } >+ >+ public String getId() { >+ return "DynamicTestsBlueSection"; //$NON-NLS-1$ >+ } >+ >+ public ISection getSectionClass() { >+ return new DynamicTestsBlueSection(); >+ } >+ >+ public String getTargetTab() { >+ return "ColorTab"; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsElementSectionDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsElementSectionDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsElementSectionDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/section/descriptors/DynamicTestsElementSectionDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,58 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.section.descriptors; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsElement; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.sections.DynamicTestsElementSection; >+import org.eclipse.ui.views.properties.tabbed.AbstractSectionDescriptor; >+import org.eclipse.ui.views.properties.tabbed.ISection; >+import org.eclipse.ui.views.properties.tabbed.ITypeMapper; >+ >+/** >+ * A section descriptor for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsElementSectionDescriptor extends >+ AbstractSectionDescriptor { >+ >+ /** >+ * Constructor for DynamicTestsElementSectionDescriptor. >+ * >+ * @param typeMapper >+ * the optional type mapper for the section. >+ */ >+ public DynamicTestsElementSectionDescriptor(ITypeMapper typeMapper) { >+ super(typeMapper); >+ } >+ >+ public String getId() { >+ return "DynamicTestsElementSection"; //$NON-NLS-1$ >+ } >+ >+ public List getInputTypes() { >+ List list = new ArrayList(); >+ list.add(DynamicTestsElement.class.getCanonicalName()); >+ return list; >+ } >+ >+ public ISection getSectionClass() { >+ return new DynamicTestsElementSection(); >+ } >+ >+ public String getTargetTab() { >+ return "ElementTab"; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsAdvancedTabDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsAdvancedTabDescriptor.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsAdvancedTabDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/tab/descriptors/DynamicTestsAdvancedTabDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,43 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.tab.descriptors; >+ >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.section.descriptors.DynamicTestsAdvancedSectionDescriptor; >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.views.DynamicTestsTypeMapper; >+import org.eclipse.ui.views.properties.tabbed.AbstractTabDescriptor; >+ >+/** >+ * A tab descriptor for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsAdvancedTabDescriptor extends AbstractTabDescriptor { >+ >+ public DynamicTestsAdvancedTabDescriptor() { >+ super(); >+ getSectionDescriptors().add( >+ new DynamicTestsAdvancedSectionDescriptor( >+ new DynamicTestsTypeMapper())); >+ } >+ >+ public String getCategory() { >+ return "advanced"; //$NON-NLS-1$ >+ } >+ >+ public String getId() { >+ return "AdvancedTab"; //$NON-NLS-1$ >+ } >+ >+ public String getLabel() { >+ return "Advanced"; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsRedSection.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsRedSection.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsRedSection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsRedSection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,28 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.sections; >+ >+/** >+ * A section for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsRedSection extends DynamicTestsAbstractLabelSection { >+ >+ public String getGroup() { >+ return "Color"; //$NON-NLS-1$ >+ } >+ >+ public String getLabel() { >+ return "A section for red elements."; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsCircleSectionFilter.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsCircleSectionFilter.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsCircleSectionFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/filters/DynamicTestsCircleSectionFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,26 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.filters; >+ >+import org.eclipse.ui.tests.views.properties.tabbed.dynamic.model.DynamicTestsShape; >+ >+/** >+ * A section filter for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsCircleSectionFilter extends >+ DynamicTestsElementSectionFilter { >+ >+ protected boolean appliesToShape(DynamicTestsShape shape) { >+ return DynamicTestsShape.CIRCLE.equals(shape); >+ } >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsGreenSection.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsGreenSection.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsGreenSection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/dynamic/sections/DynamicTestsGreenSection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,28 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed.dynamic.sections; >+ >+/** >+ * A section for the dynamic tests view. >+ * >+ * @author Anthony Hunter >+ */ >+public class DynamicTestsGreenSection extends DynamicTestsAbstractLabelSection { >+ >+ public String getGroup() { >+ return "Color"; //$NON-NLS-1$ >+ } >+ >+ public String getLabel() { >+ return "A section for green elements."; //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageTextTest.java >=================================================================== >RCS file: src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageTextTest.java >diff -N src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageTextTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageTextTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,126 @@ >+/******************************************************************************* >+ * 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.tests.views.properties.tabbed; >+ >+import junit.framework.TestCase; >+ >+import org.eclipse.jface.text.IDocument; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.ui.IViewPart; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyComposite; >+import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyList; >+import org.eclipse.ui.tests.views.properties.tabbed.text.TextTestsView; >+import org.eclipse.ui.tests.views.properties.tabbed.views.TestsPerspective; >+ >+/** >+ * Tests for the text tests view. >+ * >+ * @author Anthony Hunter >+ * @since 3.4 >+ */ >+public class TabbedPropertySheetPageTextTest extends TestCase { >+ >+ private TextTestsView textTestsView; >+ >+ protected void setUp() throws Exception { >+ super.setUp(); >+ >+ /** >+ * Close the existing perspectives. >+ */ >+ IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench() >+ .getActiveWorkbenchWindow(); >+ assertNotNull(workbenchWindow); >+ IWorkbenchPage workbenchPage = workbenchWindow.getActivePage(); >+ assertNotNull(workbenchPage); >+ workbenchPage.closeAllPerspectives(false, false); >+ >+ /** >+ * Open the tests perspective. >+ */ >+ PlatformUI.getWorkbench().showPerspective( >+ TestsPerspective.TESTS_PERSPECTIVE_ID, workbenchWindow); >+ >+ /** >+ * Open the dynamic tests view. >+ */ >+ IViewPart view = workbenchPage >+ .showView(TextTestsView.TEXT_TESTS_VIEW_ID); >+ assertNotNull(view); >+ assertTrue(view instanceof TextTestsView); >+ textTestsView = (TextTestsView) view; >+ } >+ >+ protected void tearDown() throws Exception { >+ super.tearDown(); >+ >+ /** >+ * Bug 175070: Make sure the views have finished painting. >+ */ >+ while (Display.getCurrent().readAndDispatch()) { >+ // >+ } >+ >+ } >+ >+ /** >+ * Get the list of tabs from the tabbed properties view. >+ * >+ * @return the tab list. >+ */ >+ private TabbedPropertyList getTabbedPropertyList() { >+ Control control = textTestsView.getTabbedPropertySheetPage() >+ .getControl(); >+ assertTrue(control instanceof TabbedPropertyComposite); >+ TabbedPropertyComposite tabbedPropertyComposite = (TabbedPropertyComposite) control; >+ return tabbedPropertyComposite.getList(); >+ } >+ >+ /** >+ * When text is selected, there is one tab for each selected word. >+ */ >+ public void test_tabForSelectedTextDisplay() { >+ /** >+ * select node 0 which is an Information >+ */ >+ IDocument document = textTestsView.getViewer().getDocument(); >+ document.set("This is a test"); >+ textTestsView.getViewer().setSelectedRange(0, 14); >+ >+ TabbedPropertyList tabbedPropertyList = getTabbedPropertyList(); >+ /** >+ * First tab is "This" >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(0).toString(), "This");//$NON-NLS-1$ >+ /** >+ * Second tab is "is" >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(1).toString(), >+ "is");//$NON-NLS-1$ >+ /** >+ * Third tab is "a" >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(2).toString(), "a");//$NON-NLS-1$ >+ /** >+ * Third tab is "test" >+ */ >+ assertEquals(tabbedPropertyList.getElementAt(3).toString(), "test");//$NON-NLS-1$ >+ /** >+ * No fifth tab >+ */ >+ assertNull(tabbedPropertyList.getElementAt(4)); >+ } >+ >+} >#P org.eclipse.ui.views.properties.tabbed >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/META-INF/MANIFEST.MF,v >retrieving revision 1.10 >diff -u -r1.10 MANIFEST.MF >--- META-INF/MANIFEST.MF 4 Jun 2007 19:59:24 -0000 1.10 >+++ META-INF/MANIFEST.MF 1 Aug 2007 18:26:06 -0000 >@@ -2,7 +2,7 @@ > Bundle-ManifestVersion: 2 > Bundle-Name: %Plugin.name > Bundle-SymbolicName: org.eclipse.ui.views.properties.tabbed;singleton:=true >-Bundle-Version: 3.3.0.qualifier >+Bundle-Version: 3.4.0.qualifier > Bundle-Activator: org.eclipse.ui.internal.views.properties.tabbed.TabbedPropertyViewPlugin > Bundle-Vendor: %Plugin.providerName > Bundle-Localization: plugin >Index: src/org/eclipse/ui/views/properties/tabbed/ITabSelectionListener.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/views/properties/tabbed/ITabSelectionListener.java,v >retrieving revision 1.2 >diff -u -r1.2 ITabSelectionListener.java >--- src/org/eclipse/ui/views/properties/tabbed/ITabSelectionListener.java 17 Apr 2006 18:56:22 -0000 1.2 >+++ src/org/eclipse/ui/views/properties/tabbed/ITabSelectionListener.java 1 Aug 2007 18:26:07 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2001, 2006 IBM Corporation and others. >+ * Copyright (c) 2001, 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 >@@ -10,8 +10,6 @@ > *******************************************************************************/ > package org.eclipse.ui.views.properties.tabbed; > >-import org.eclipse.ui.internal.views.properties.tabbed.view.TabDescriptor; >- > /** > * A listener interested in tab selection events that occur for the tabbed > * property sheet page. >@@ -26,5 +24,5 @@ > * @param tabDescriptor > * the selected tab descriptor. > */ >- public void tabSelected(TabDescriptor tabDescriptor); >+ public void tabSelected(ITabDescriptor tabDescriptor); > } >Index: src/org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage.java,v >retrieving revision 1.9 >diff -u -r1.9 TabbedPropertySheetPage.java >--- src/org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage.java 17 Apr 2007 20:22:26 -0000 1.9 >+++ src/org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage.java 1 Aug 2007 18:26:07 -0000 >@@ -45,8 +45,6 @@ > import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.actions.ActionFactory; >-import org.eclipse.ui.internal.views.properties.tabbed.view.Tab; >-import org.eclipse.ui.internal.views.properties.tabbed.view.TabDescriptor; > import org.eclipse.ui.internal.views.properties.tabbed.view.TabListContentProvider; > import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyComposite; > import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyRegistry; >@@ -92,7 +90,7 @@ > > private TabbedPropertyViewer tabbedPropertyViewer; > >- private Tab currentTab; >+ private TabContents currentTab; > > private Map descriptorToTab; > >@@ -163,8 +161,8 @@ > extends LabelProvider { > > public String getText(Object element) { >- if (element instanceof TabDescriptor) { >- return ((TabDescriptor) element).getLabel(); >+ if (element instanceof ITabDescriptor) { >+ return ((ITabDescriptor) element).getLabel(); > } > return null; > } >@@ -182,8 +180,8 @@ > public void selectionChanged(SelectionChangedEvent event) { > IStructuredSelection selection = (IStructuredSelection) event > .getSelection(); >- Tab tab = null; >- TabDescriptor descriptor = (TabDescriptor) selection >+ TabContents tab = null; >+ ITabDescriptor descriptor = (ITabDescriptor) selection > .getFirstElement(); > > if (descriptor == null) { >@@ -193,7 +191,7 @@ > // create tab if necessary > // can not cache based on the id - tabs may have the same id, > // but different section depending on the selection >- tab = (Tab) descriptorToTab.get(descriptor); >+ tab = (TabContents) descriptorToTab.get(descriptor); > > if (tab != currentTab) { > hideTab(currentTab); >@@ -232,7 +230,7 @@ > /** > * Shows the given tab. > */ >- private void showTab(Tab target) { >+ private void showTab(TabContents target) { > if (target != null) { > Composite tabComposite = (Composite) tabToComposite.get(target); > if (tabComposite != null) { >@@ -250,7 +248,7 @@ > /** > * Hides the given tab. > */ >- private void hideTab(Tab target) { >+ private void hideTab(TabContents target) { > if (target != null) { > Composite tabComposite = (Composite) tabToComposite.get(target); > if (tabComposite != null) { >@@ -561,7 +559,7 @@ > > private void disposeTabs(Collection tabs) { > for (Iterator iter = tabs.iterator(); iter.hasNext();) { >- Tab tab = (Tab) iter.next(); >+ TabContents tab = (TabContents) iter.next(); > Composite composite = (Composite) tabToComposite.remove(tab); > tab.dispose(); > if (composite != null) { >@@ -574,7 +572,7 @@ > * Returns the last known selected tab for the given input. > */ > private int getLastTabSelection(IWorkbenchPart part, ISelection input) { >- TabDescriptor[] descriptors = registry.getTabDescriptors(part, input); >+ ITabDescriptor[] descriptors = registry.getTabDescriptors(part, input); > if (descriptors.length != 0) { > for (Iterator iter = selectionQueue.iterator(); iter.hasNext();) { > String text = (String) iter.next(); >@@ -594,18 +592,18 @@ > * disposed. If the current visible tab will not be reused (i.e. will be > * disposed) we have to send it an aboutToBeHidden() message. > */ >- protected void updateTabs(TabDescriptor[] descriptors) { >+ protected void updateTabs(ITabDescriptor[] descriptors) { > Map newTabs = new HashMap(descriptors.length * 2); > boolean disposingCurrentTab = (currentTab != null); > for (int i = 0; i < descriptors.length; i++) { >- Tab tab = (Tab) descriptorToTab.remove(descriptors[i]); >+ TabContents tab = (TabContents) descriptorToTab.remove(descriptors[i]); > > if (tab != null && tab.controlsHaveBeenCreated()) { > if (tab == currentTab) { > disposingCurrentTab = false; > } > } else { >- tab = (descriptors[i]).createTab(); >+ tab = createTab(descriptors[i]); > } > > newTabs.put(descriptors[i], tab); >@@ -623,6 +621,17 @@ > } > > /** >+ * Create the tab contents for the provided tab descriptor. >+ * >+ * @param tabDescriptor >+ * the tab descriptor. >+ * @return the tab contents. >+ */ >+ protected TabContents createTab(ITabDescriptor tabDescriptor) { >+ return tabDescriptor.createTab(); >+ } >+ >+ /** > * Helper method for creating property tab composites. > */ > private Composite createTabComposite() { >@@ -652,7 +661,7 @@ > > // see if the selection provides a new contributor > validateRegistry(selection); >- TabDescriptor[] descriptors = registry.getTabDescriptors(part, >+ ITabDescriptor[] descriptors = registry.getTabDescriptors(part, > currentSelection); > // If there are no descriptors for the given input we do not need to > // touch the tab objects. We might reuse them for the next valid >@@ -691,7 +700,7 @@ > * > * @return the currently active tab. > */ >- public Tab getCurrentTab() { >+ public TabContents getCurrentTab() { > return currentTab; > } > >@@ -701,7 +710,7 @@ > * @param tabDescriptor > * the new selected tab. > */ >- private void handleTabSelection(TabDescriptor tabDescriptor) { >+ private void handleTabSelection(ITabDescriptor tabDescriptor) { > if (selectionQueueLocked) { > /* > * don't send tab selection events for non user changes. >Index: src/org/eclipse/ui/views/properties/tabbed/AbstractPropertySection.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/views/properties/tabbed/AbstractPropertySection.java,v >retrieving revision 1.1 >diff -u -r1.1 AbstractPropertySection.java >--- src/org/eclipse/ui/views/properties/tabbed/AbstractPropertySection.java 30 Jan 2006 21:34:23 -0000 1.1 >+++ src/org/eclipse/ui/views/properties/tabbed/AbstractPropertySection.java 1 Aug 2007 18:26:07 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2001, 2006 IBM Corporation and others. >+ * Copyright (c) 2001, 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 >Index: src/org/eclipse/ui/views/properties/tabbed/ISectionDescriptor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/views/properties/tabbed/ISectionDescriptor.java,v >retrieving revision 1.1 >diff -u -r1.1 ISectionDescriptor.java >--- src/org/eclipse/ui/views/properties/tabbed/ISectionDescriptor.java 30 Jan 2006 21:34:23 -0000 1.1 >+++ src/org/eclipse/ui/views/properties/tabbed/ISectionDescriptor.java 1 Aug 2007 18:26:07 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2001, 2006 IBM Corporation and others. >+ * Copyright (c) 2001, 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 >@@ -18,17 +18,28 @@ > > /** > * Represents a section descriptor on the tabbed property sections extensions. >+ * <p> >+ * This interface should not be extended or implemented. New instances should be >+ * created using <code>AbstractSectionDescriptor</code>. >+ * </p> > * >- * @author Anthony Hunter >+ * @author Anthony Hunter > */ > public interface ISectionDescriptor { > > /** >- * If enabledFor is not specified in the descriptor, enable for any selection. >+ * If enabledFor is not specified in the descriptor, enable for any >+ * selection. > */ > public final int ENABLES_FOR_ANY = -1; > > /** >+ * If afterSection is not specified in the descriptor, we default to be the >+ * top section. >+ */ >+ public static final String TOP = "top"; //$NON-NLS-1$ >+ >+ /** > * Get the unique identifier for the section. > * > * @return the unique identifier for the section. >@@ -65,27 +76,31 @@ > public String getTargetTab(); > > /** >- * Get the value for section enablement which is a precise number of >- * items selected. For example: enablesFor="1" enables the section only when >- * one item is selected. If not specified, enable for any selection and return ENABLES_FOR_ANY. >+ * Get the value for section enablement which is a precise number of items >+ * selected. For example: enablesFor="1" enables the section only when one >+ * item is selected. If not specified, enable for any selection and return >+ * ENABLES_FOR_ANY. > * > * @return the value for section enablement. > */ > public int getEnablesFor(); >- >+ > /** > * Determines if this section applies to the selection. >- * @param part the current workbench part. >- * @param selection the selection. >+ * >+ * @param part >+ * the current workbench part. >+ * @param selection >+ * the selection. > * @return <code>true</code> if this section applies to the current > * selection. > */ > public boolean appliesTo(IWorkbenchPart part, ISelection selection); > > /** >- * Get the section identifier below which this section is displayed. <code>"top"</code> >- * is returned if this section is the top most section or if there is one >- * section in the tab. >+ * Get the section identifier below which this section is displayed. >+ * <code>"top"</code> is returned if this section is the top most section >+ * or if there is one section in the tab. > * > * @return the section identifier. > */ >Index: schema/propertyContributor.exsd >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/schema/propertyContributor.exsd,v >retrieving revision 1.2 >diff -u -r1.2 propertyContributor.exsd >--- schema/propertyContributor.exsd 29 Aug 2006 13:27:39 -0000 1.2 >+++ schema/propertyContributor.exsd 1 Aug 2007 18:26:06 -0000 >@@ -81,6 +81,26 @@ > </appInfo> > </annotation> > </attribute> >+ <attribute name="sectionDescriptorProvider" type="string"> >+ <annotation> >+ <documentation> >+ The class that implements the section descriptor provider for the property sheet page, i.e. implements <tt>org.eclipse.ui.views.properties.tabbed.ISectionDescriptorProvider</tt> >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn="org.eclipse.ui.views.properties.tabbed.ISectionDescriptorProvider"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ <attribute name="tabDescriptorProvider" type="string"> >+ <annotation> >+ <documentation> >+ The class that implements the tab descriptor provider for the property sheet page, i.e. implements <tt>org.eclipse.ui.views.properties.tabbed.ITabDescriptorProvider</tt> >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn="org.eclipse.ui.views.properties.tabbed.ITabDescriptorProvider"/> >+ </appInfo> >+ </annotation> >+ </attribute> > </complexType> > </element> > >Index: src/org/eclipse/ui/internal/views/properties/tabbed/l10n/TabbedPropertyMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/l10n/TabbedPropertyMessages.java,v >retrieving revision 1.1 >diff -u -r1.1 TabbedPropertyMessages.java >--- src/org/eclipse/ui/internal/views/properties/tabbed/l10n/TabbedPropertyMessages.java 17 Apr 2006 19:03:55 -0000 1.1 >+++ src/org/eclipse/ui/internal/views/properties/tabbed/l10n/TabbedPropertyMessages.java 1 Aug 2007 18:26:06 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 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 >@@ -35,6 +35,11 @@ > */ > public static String SectionDescriptor_Section_error; > >+ /** >+ * Message when a property section extension causes a class not found exception. >+ */ >+ public static String SectionDescriptor_class_not_found_error; >+ > /** > * Message when a property tab extension is in error. > */ >Index: src/org/eclipse/ui/internal/views/properties/tabbed/l10n/TabbedPropertyMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/l10n/TabbedPropertyMessages.properties,v >retrieving revision 1.1 >diff -u -r1.1 TabbedPropertyMessages.properties >--- src/org/eclipse/ui/internal/views/properties/tabbed/l10n/TabbedPropertyMessages.properties 17 Apr 2006 19:03:55 -0000 1.1 >+++ src/org/eclipse/ui/internal/views/properties/tabbed/l10n/TabbedPropertyMessages.properties 1 Aug 2007 18:26:06 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2001, 2006 IBM Corporation and others. >+# Copyright (c) 2001, 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 >@@ -9,6 +9,7 @@ > # IBM Corporation - initial API and implementation > ############################################################################### > SectionDescriptor_Section_error=Section in {0} must provide an id and a tab. >+SectionDescriptor_class_not_found_error=Section {0} declares non-existing filter or section class. > TabDescriptor_Tab_error=Tab in {0} must provide an id, label and category. > TabbedPropertyRegistry_Non_existing_tab=Section {0} declares non-existing tab {1}. > TabbedPropertyRegistry_contributor_error=Contributor {0} cannot be created. >Index: src/org/eclipse/ui/internal/views/properties/tabbed/view/SectionDescriptor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/SectionDescriptor.java,v >retrieving revision 1.1 >diff -u -r1.1 SectionDescriptor.java >--- src/org/eclipse/ui/internal/views/properties/tabbed/view/SectionDescriptor.java 17 Apr 2006 19:03:55 -0000 1.1 >+++ src/org/eclipse/ui/internal/views/properties/tabbed/view/SectionDescriptor.java 1 Aug 2007 18:26:06 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2001, 2006 IBM Corporation and others. >+ * Copyright (c) 2001, 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 >@@ -10,7 +10,6 @@ > *******************************************************************************/ > package org.eclipse.ui.internal.views.properties.tabbed.view; > >-import com.ibm.icu.text.MessageFormat; > import java.util.ArrayList; > import java.util.List; > >@@ -19,15 +18,15 @@ > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Status; > import org.eclipse.jface.viewers.IFilter; >-import org.eclipse.jface.viewers.ISelection; >-import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.internal.views.properties.tabbed.TabbedPropertyViewPlugin; > import org.eclipse.ui.internal.views.properties.tabbed.TabbedPropertyViewStatusCodes; > import org.eclipse.ui.internal.views.properties.tabbed.l10n.TabbedPropertyMessages; >+import org.eclipse.ui.views.properties.tabbed.AbstractSectionDescriptor; > import org.eclipse.ui.views.properties.tabbed.ISection; >-import org.eclipse.ui.views.properties.tabbed.ISectionDescriptor; > import org.eclipse.ui.views.properties.tabbed.ITypeMapper; > >+import com.ibm.icu.text.MessageFormat; >+ > /** > * Represents the default implementation of a section descriptor on the tabbed > * property sections extensions. This implementation assumes that we are >@@ -35,10 +34,7 @@ > * > * @author Anthony Hunter > */ >-public class SectionDescriptor >- implements ISectionDescriptor { >- >- private final static String SECTION_ERROR = TabbedPropertyMessages.SectionDescriptor_Section_error; >+public class SectionDescriptor extends AbstractSectionDescriptor { > > private static final String ATT_ID = "id"; //$NON-NLS-1$ > >@@ -56,8 +52,6 @@ > > private static final String ELEMENT_INPUT = "input"; //$NON-NLS-1$ > >- private static final String TOP = "top"; //$NON-NLS-1$ >- > private String id; > > private String targetTab; >@@ -66,8 +60,6 @@ > > private ArrayList inputTypes; > >- private TabbedPropertyRegistryClassSectionFilter classFilter; >- > private IFilter filter; > > private int enablesFor = ENABLES_FOR_ANY; >@@ -84,16 +76,16 @@ > */ > protected SectionDescriptor(IConfigurationElement configurationElement, > ITypeMapper typeMapper) { >+ super(typeMapper); > this.configurationElement = configurationElement; > >- classFilter = new TabbedPropertyRegistryClassSectionFilter(typeMapper); > id = getConfigurationElement().getAttribute(ATT_ID); > targetTab = getConfigurationElement().getAttribute(ATT_TARGET_TAB); > afterSection = getConfigurationElement() >- .getAttribute(ATT_AFTER_SECTION); >+ .getAttribute(ATT_AFTER_SECTION); > if (getConfigurationElement().getAttribute(ATT_SECTION_ENABLES_FOR) != null) { > String enablesForStr = getConfigurationElement().getAttribute( >- ATT_SECTION_ENABLES_FOR); >+ ATT_SECTION_ENABLES_FOR); > int enablesForTest = Integer.parseInt(enablesForStr); > if (enablesForTest > 0) { > enablesFor = enablesForTest; >@@ -104,9 +96,6 @@ > // the section id and tab are mandatory - log error > handleSectionError(null); > } >- if (getAfterSection() == null) { >- afterSection = TOP; >- } > } > > /** >@@ -120,11 +109,20 @@ > */ > private void handleSectionError(CoreException exception) { > String pluginId = getConfigurationElement().getDeclaringExtension() >- .getNamespace(); >- String message = MessageFormat.format(SECTION_ERROR, >- new Object[] {pluginId}); >+ .getNamespaceIdentifier(); >+ String message = TabbedPropertyMessages.SectionDescriptor_Section_error; >+ if (exception == null) { >+ message = MessageFormat.format( >+ TabbedPropertyMessages.SectionDescriptor_Section_error, >+ new Object[] { pluginId }); >+ } else { >+ message = MessageFormat >+ .format( >+ TabbedPropertyMessages.SectionDescriptor_class_not_found_error, >+ new Object[] { pluginId }); >+ } > IStatus status = new Status(IStatus.ERROR, pluginId, >- TabbedPropertyViewStatusCodes.SECTION_ERROR, message, exception); >+ TabbedPropertyViewStatusCodes.SECTION_ERROR, message, exception); > TabbedPropertyViewPlugin.getPlugin().getLog().log(status); > } > >@@ -143,7 +141,7 @@ > try { > if (getConfigurationElement().getAttribute(ATT_SECTION_FILTER) != null) { > filter = (IFilter) configurationElement >- .createExecutableExtension(ATT_SECTION_FILTER); >+ .createExecutableExtension(ATT_SECTION_FILTER); > } > } catch (CoreException exception) { > handleSectionError(exception); >@@ -171,17 +169,12 @@ > } > > /** >- * @see org.eclipse.ui.views.properties.tabbed.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, >- * org.eclipse.jface.viewers.ISelection) >- */ >- public boolean appliesTo(IWorkbenchPart part, ISelection selection) { >- return classFilter.appliesToSelection(this, selection); >- } >- >- /** > * @see org.eclipse.ui.views.properties.tabbed.ISectionDescriptor#getAfterSection() > */ > public String getAfterSection() { >+ if (afterSection == null) { >+ return super.getAfterSection(); >+ } > return afterSection; > } > >@@ -194,7 +187,7 @@ > ISection section = null; > try { > section = (ISection) getConfigurationElement() >- .createExecutableExtension(ATT_CLASS); >+ .createExecutableExtension(ATT_CLASS); > } catch (CoreException exception) { > handleSectionError(exception); > } >@@ -211,7 +204,7 @@ > if (inputTypes == null) { > inputTypes = new ArrayList(); > IConfigurationElement[] elements = getConfigurationElement() >- .getChildren(ELEMENT_INPUT); >+ .getChildren(ELEMENT_INPUT); > for (int i = 0; i < elements.length; i++) { > IConfigurationElement element = elements[i]; > inputTypes.add(element.getAttribute(ATT_INPUT_TYPE)); >Index: src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistryFactory.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistryFactory.java,v >retrieving revision 1.1 >diff -u -r1.1 TabbedPropertyRegistryFactory.java >--- src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistryFactory.java 17 Apr 2006 19:03:55 -0000 1.1 >+++ src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistryFactory.java 1 Aug 2007 18:26:07 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2001, 2006 IBM Corporation and others. >+ * Copyright (c) 2001, 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 >@@ -17,7 +17,6 @@ > > import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor; > >- > /** > * tabbed property registry factory. Caches the tabbed property registry > * by tabbed property contributor ID. >@@ -38,7 +37,8 @@ > new TabbedPropertyRegistryFactory(); > > /** >- * get the singleton instance of this class >+ * get the singleton instance of this class. >+ * @return the TabbedPropertyRegistryFactory instance. > */ > public static TabbedPropertyRegistryFactory getInstance() { > return INSTANCE; >@@ -56,6 +56,8 @@ > > /** > * Creates a registry for the given contributor. >+ * @param target the contributor. >+ * @return a registry for the given contributor. > */ > public TabbedPropertyRegistry createRegistry(ITabbedPropertySheetPageContributor target) { > /** >@@ -79,6 +81,7 @@ > * Indicates that the given contributor no longer needs > * a registry. The registry will be disposed when > * no other contributor of the same type needs it. >+ * @param target the contributor; > */ > public void disposeRegistry(ITabbedPropertySheetPageContributor target) { > /** >Index: src/org/eclipse/ui/internal/views/properties/tabbed/view/TabDescriptor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/TabDescriptor.java,v >retrieving revision 1.1 >diff -u -r1.1 TabDescriptor.java >--- src/org/eclipse/ui/internal/views/properties/tabbed/view/TabDescriptor.java 17 Apr 2006 19:03:55 -0000 1.1 >+++ src/org/eclipse/ui/internal/views/properties/tabbed/view/TabDescriptor.java 1 Aug 2007 18:26:07 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2001, 2006 IBM Corporation and others. >+ * Copyright (c) 2001, 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 >@@ -10,11 +10,6 @@ > *******************************************************************************/ > package org.eclipse.ui.internal.views.properties.tabbed.view; > >-import com.ibm.icu.text.MessageFormat; >-import java.util.ArrayList; >-import java.util.Iterator; >-import java.util.List; >- > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IConfigurationElement; > import org.eclipse.core.runtime.IStatus; >@@ -24,9 +19,10 @@ > import org.eclipse.ui.internal.views.properties.tabbed.TabbedPropertyViewStatusCodes; > import org.eclipse.ui.internal.views.properties.tabbed.l10n.TabbedPropertyMessages; > import org.eclipse.ui.plugin.AbstractUIPlugin; >-import org.eclipse.ui.views.properties.tabbed.ISection; >+import org.eclipse.ui.views.properties.tabbed.AbstractTabDescriptor; > import org.eclipse.ui.views.properties.tabbed.ISectionDescriptor; >-import org.eclipse.ui.views.properties.tabbed.ITabItem; >+ >+import com.ibm.icu.text.MessageFormat; > > /** > * Represents the default implementation of a tab descriptor on the tabbed >@@ -34,8 +30,7 @@ > * > * @author Anthony Hunter > */ >-public class TabDescriptor >- implements Cloneable, ITabItem { >+public class TabDescriptor extends AbstractTabDescriptor { > > private static final String ATT_ID = "id"; //$NON-NLS-1$ > >@@ -49,8 +44,6 @@ > > private static final String ATT_AFTER_TAB = "afterTab"; //$NON-NLS-1$ > >- private static final String TOP = "top"; //$NON-NLS-1$ >- > private final static String TAB_ERROR = TabbedPropertyMessages.TabDescriptor_Tab_error; > > private String id; >@@ -67,8 +60,6 @@ > > private String afterTab; > >- private List sectionDescriptors; >- > /** > * Constructor for TabDescriptor. > * >@@ -76,18 +67,19 @@ > * the configuration element for the tab descriptor. > */ > public TabDescriptor(IConfigurationElement configurationElement) { >+ super(); > if (configurationElement != null) { > id = configurationElement.getAttribute(ATT_ID); > label = configurationElement.getAttribute(ATT_LABEL); > String imageString = configurationElement.getAttribute(ATT_IMAGE); > if (imageString != null) { >- image = AbstractUIPlugin >- .imageDescriptorFromPlugin( >+ image = AbstractUIPlugin.imageDescriptorFromPlugin( > configurationElement.getDeclaringExtension() >- .getNamespace(), imageString).createImage(); >+ .getNamespaceIdentifier(), imageString) >+ .createImage(); > } > String indentedString = configurationElement >- .getAttribute(ATT_INDENTED); >+ .getAttribute(ATT_INDENTED); > indented = indentedString != null && indentedString.equals("true"); //$NON-NLS-1$ > category = configurationElement.getAttribute(ATT_CATEGORY); > afterTab = configurationElement.getAttribute(ATT_AFTER_TAB); >@@ -96,10 +88,6 @@ > handleTabError(configurationElement, null); > } > } >- if (getAfterTab() == null) { >- afterTab = TOP; >- } >- sectionDescriptors = new ArrayList(5); > selected = false; > } > >@@ -128,7 +116,10 @@ > * > * @return the identifier of the tab. > */ >- protected String getAfterTab() { >+ public String getAfterTab() { >+ if (afterTab == null) { >+ return super.getAfterTab(); >+ } > return afterTab; > } > >@@ -137,7 +128,7 @@ > * > * @return Get the category this tab belongs to. > */ >- protected String getCategory() { >+ public String getCategory() { > return category; > } > >@@ -158,7 +149,7 @@ > return true; > } > >- sectionDescriptors.add(target); >+ getSectionDescriptors().add(target); > return true; > } > >@@ -172,61 +163,24 @@ > */ > private boolean insertSectionDescriptor(ISectionDescriptor target) { > if (target.getAfterSection().equals(TOP)) { >- sectionDescriptors.add(0, target); >+ getSectionDescriptors().add(0, target); > return true; > } >- for (int i = 0; i < sectionDescriptors.size(); i++) { >- ISectionDescriptor descriptor = (ISectionDescriptor) sectionDescriptors >- .get(i); >+ for (int i = 0; i < getSectionDescriptors().size(); i++) { >+ ISectionDescriptor descriptor = (ISectionDescriptor) getSectionDescriptors() >+ .get(i); > if (target.getAfterSection().equals(descriptor.getId())) { >- sectionDescriptors.add(i + 1, target); >+ getSectionDescriptors().add(i + 1, target); >+ return true; >+ } else if (descriptor.getAfterSection().equals(target.getId())) { >+ getSectionDescriptors().add(i, target); > return true; >- } else { >- if (descriptor.getAfterSection().equals(target.getId())) { >- sectionDescriptors.add(i, target); >- return true; >- } > } > } > return false; > } > > /** >- * Instantiate this tab's sections. >- */ >- public Tab createTab() { >- List sections = new ArrayList(sectionDescriptors.size()); >- for (Iterator iter = sectionDescriptors.iterator(); iter.hasNext();) { >- ISectionDescriptor descriptor = (ISectionDescriptor) iter.next(); >- ISection section = descriptor.getSectionClass(); >- sections.add(section); >- } >- Tab tab = new Tab(); >- tab.setSections((ISection[]) sections.toArray(new ISection[sections >- .size()])); >- return tab; >- } >- >- /** >- * Get the list of section descriptors for the tab. >- * >- * @return the list of section descriptors for the tab. >- */ >- protected List getSectionDescriptors() { >- return sectionDescriptors; >- } >- >- /** >- * Set the list of section descriptors for the tab. >- * >- * @param sectionDescriptors >- * the list of section descriptors for the tab. >- */ >- protected void setSectionDescriptors(List sectionDescriptors) { >- this.sectionDescriptors = sectionDescriptors; >- } >- >- /** > * @see java.lang.Object#toString() > */ > public String toString() { >@@ -245,82 +199,15 @@ > private void handleTabError(IConfigurationElement configurationElement, > CoreException exception) { > String pluginId = configurationElement.getDeclaringExtension() >- .getNamespace(); >+ .getNamespaceIdentifier(); > String message = MessageFormat.format(TAB_ERROR, >- new Object[] {pluginId}); >+ new Object[] { pluginId }); > IStatus status = new Status(IStatus.ERROR, pluginId, >- TabbedPropertyViewStatusCodes.TAB_ERROR, message, exception); >+ TabbedPropertyViewStatusCodes.TAB_ERROR, message, exception); > TabbedPropertyViewPlugin.getPlugin().getLog().log(status); > } > > /** >- * @see java.lang.Object#equals(java.lang.Object) >- */ >- public boolean equals(Object object) { >- if (this == object) { >- return true; >- } >- >- if (this.getClass() == object.getClass()) { >- TabDescriptor descriptor = (TabDescriptor) object; >- if (this.getCategory().equals(descriptor.getCategory()) >- && this.getId().equals(descriptor.getId()) >- && this.getSectionDescriptors().size() == descriptor >- .getSectionDescriptors().size()) { >- >- Iterator i = this.getSectionDescriptors().iterator(); >- Iterator j = descriptor.getSectionDescriptors().iterator(); >- >- // the order is importent here - so as long as the sizes of the >- // lists are the same and id of the section at the same >- // positions are the same - the lists are the same >- while (i.hasNext()) { >- ISectionDescriptor source = (ISectionDescriptor) i.next(); >- ISectionDescriptor target = (ISectionDescriptor) j.next(); >- if (!source.getId().equals(target.getId())) { >- return false; >- } >- } >- >- return true; >- } >- >- } >- >- return false; >- } >- >- /** >- * @see java.lang.Object#hashCode() >- */ >- public int hashCode() { >- >- int hashCode = getCategory().hashCode(); >- hashCode ^= getId().hashCode(); >- Iterator i = this.getSectionDescriptors().iterator(); >- while (i.hasNext()) { >- ISectionDescriptor section = (ISectionDescriptor) i.next(); >- hashCode ^= section.getId().hashCode(); >- } >- return hashCode; >- } >- >- /** >- * @see java.lang.Object#clone() >- */ >- public Object clone() { >- try { >- return super.clone(); >- } catch (CloneNotSupportedException exception) { >- IStatus status = new Status(IStatus.ERROR, TabbedPropertyViewPlugin >- .getPlugin().getBundle().getSymbolicName(), 666, exception >- .getMessage(), exception); >- TabbedPropertyViewPlugin.getPlugin().getLog().log(status); >- } >- return null; >- } >- >- /** > * Set the image for the tab. > * > * @param image >Index: src/org/eclipse/ui/internal/views/properties/tabbed/view/Tab.java >=================================================================== >RCS file: src/org/eclipse/ui/internal/views/properties/tabbed/view/Tab.java >diff -N src/org/eclipse/ui/internal/views/properties/tabbed/view/Tab.java >--- src/org/eclipse/ui/internal/views/properties/tabbed/view/Tab.java 17 Apr 2006 19:03:55 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,240 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2001, 2006 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.views.properties.tabbed.view; >- >-import org.eclipse.core.runtime.ISafeRunnable; >-import org.eclipse.core.runtime.Platform; >-import org.eclipse.jface.viewers.ISelection; >-import org.eclipse.swt.SWT; >-import org.eclipse.swt.layout.FillLayout; >-import org.eclipse.swt.layout.GridData; >-import org.eclipse.swt.layout.GridLayout; >-import org.eclipse.swt.widgets.Composite; >-import org.eclipse.ui.IWorkbenchPart; >-import org.eclipse.ui.views.properties.tabbed.ISection; >-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; >- >-/** >- * A property tab is composed by one or more property sections and is used to >- * categorize sections. >- * >- * @author Anthony Hunter >- */ >-public class Tab { >- >- private ISection[] sections; >- >- private boolean controlsCreated; >- >- Tab() { >- controlsCreated = false; >- } >- >- /** >- * Retrieve a numbered index for the section. >- * @param section the section. >- * @return the section index. >- */ >- public int getSectionIndex(ISection section) { >- for (int i = 0; i < sections.length; i++) { >- if (section == sections[i]) { >- return i; >- } >- } >- return -1; >- } >- >- /** >- * Retrieve the section at a numbered index. >- * @param i a numbered index. >- * @return the section. >- */ >- public ISection getSectionAtIndex(int i) { >- if (i >= 0 && i < sections.length) { >- return sections[i]; >- } >- return null; >- } >- >- /** >- * Retrieve the sections on the tab. >- * >- * @return the sections on the tab. >- */ >- public ISection[] getSections() { >- return sections; >- } >- >- /** >- * Creates page's sections controls. >- * >- * @param parent >- * @param page >- */ >- public void createControls(Composite parent, >- final TabbedPropertySheetPage page) { >- Composite pageComposite = page.getWidgetFactory().createComposite( >- parent, SWT.NO_FOCUS); >- GridLayout layout = new GridLayout(); >- layout.marginWidth = 0; >- layout.marginHeight = 0; >- layout.verticalSpacing = 0; >- pageComposite.setLayout(layout); >- >- for (int i = 0; i < sections.length; i++) { >- final ISection section = sections[i]; >- final Composite sectionComposite = page.getWidgetFactory() >- .createComposite(pageComposite, SWT.NO_FOCUS); >- sectionComposite.setLayout(new FillLayout()); >- int style = (section.shouldUseExtraSpace()) ? GridData.FILL_BOTH >- : GridData.FILL_HORIZONTAL; >- GridData data = new GridData(style); >- data.heightHint = section.getMinimumHeight(); >- sectionComposite.setLayoutData(data); >- >- ISafeRunnable runnable = new ISafeRunnable() { >- >- public void run() >- throws Exception { >- section.createControls(sectionComposite, page); >- } >- >- public void handleException(Throwable exception) { >- /* not used */ >- } >- }; >- Platform.run(runnable); >- } >- controlsCreated = true; >- } >- >- /** >- * Dispose of page's sections controls. >- */ >- public void dispose() { >- for (int i = 0; i < sections.length; i++) { >- final ISection section = sections[i]; >- ISafeRunnable runnable = new ISafeRunnable() { >- >- public void run() >- throws Exception { >- section.dispose(); >- } >- >- public void handleException(Throwable exception) { >- /* not used */ >- } >- }; >- Platform.run(runnable); >- } >- } >- >- /** >- * Sends the lifecycle event to the page's sections. >- */ >- public void aboutToBeShown() { >- for (int i = 0; i < sections.length; i++) { >- final ISection section = sections[i]; >- ISafeRunnable runnable = new ISafeRunnable() { >- >- public void run() >- throws Exception { >- section.aboutToBeShown(); >- } >- >- public void handleException(Throwable exception) { >- /* not used */ >- } >- }; >- Platform.run(runnable); >- } >- } >- >- /** >- * Sends the lifecycle event to the page's sections. >- */ >- public void aboutToBeHidden() { >- for (int i = 0; i < sections.length; i++) { >- final ISection section = sections[i]; >- ISafeRunnable runnable = new ISafeRunnable() { >- >- public void run() >- throws Exception { >- section.aboutToBeHidden(); >- } >- >- public void handleException(Throwable exception) { >- /* not used */ >- } >- }; >- Platform.run(runnable); >- } >- } >- >- /** >- * Sets page's sections input objects. >- * >- * @param part >- * @param selection >- */ >- public void setInput(final IWorkbenchPart part, final ISelection selection) { >- for (int i = 0; i < sections.length; i++) { >- final ISection section = sections[i]; >- ISafeRunnable runnable = new ISafeRunnable() { >- >- public void run() >- throws Exception { >- section.setInput(part, selection); >- } >- >- public void handleException(Throwable throwable) { >- throwable.printStackTrace(); >- } >- }; >- Platform.run(runnable); >- } >- } >- >- void setSections(ISection[] sections) { >- this.sections = sections; >- } >- >- /** >- * >- * @return <code>true</code> if controls have been created. >- */ >- public boolean controlsHaveBeenCreated() { >- return controlsCreated; >- } >- >- /** >- * If controls have been created, refresh all sections on the page. >- */ >- public void refresh() { >- if (controlsCreated) { >- for (int i = 0; i < sections.length; i++) { >- final ISection section = sections[i]; >- ISafeRunnable runnable = new ISafeRunnable() { >- >- public void run() >- throws Exception { >- section.refresh(); >- } >- >- public void handleException(Throwable throwable) { >- throwable.printStackTrace(); >- } >- }; >- Platform.run(runnable); >- } >- } >- } >-} >Index: src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistryClassSectionFilter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistryClassSectionFilter.java,v >retrieving revision 1.1 >diff -u -r1.1 TabbedPropertyRegistryClassSectionFilter.java >--- src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistryClassSectionFilter.java 17 Apr 2006 19:03:55 -0000 1.1 >+++ src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistryClassSectionFilter.java 1 Aug 2007 18:26:07 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2001, 2006 IBM Corporation and others. >+ * Copyright (c) 2001, 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 >@@ -35,9 +35,12 @@ > private ITypeMapper typeMapper = null; > > /** >- * constructor. >+ * Constructor for TabbedPropertyRegistryClassSectionFilter >+ * >+ * @param typeMapper >+ * the type mapper. > */ >- protected TabbedPropertyRegistryClassSectionFilter(ITypeMapper typeMapper) { >+ public TabbedPropertyRegistryClassSectionFilter(ITypeMapper typeMapper) { > super(); > this.typeMapper = typeMapper; > } >@@ -45,16 +48,20 @@ > /** > * Verifies if the property section extension represented by sectionElement > * applies to the given input. >+ * @param descriptor the section descriptor. >+ * @param selection the selection. >+ * @return <code>true</code> if this section applies to the current >+ * selection. > */ >- protected boolean appliesToSelection(ISectionDescriptor descriptor, >+ public boolean appliesToSelection(ISectionDescriptor descriptor, > ISelection selection) { > >- if (selection instanceof IStructuredSelection >- && selection.isEmpty() == false) { >+ if (selection instanceof IStructuredSelection && >+ selection.isEmpty() == false) { > >- if (descriptor.getEnablesFor() != ISectionDescriptor.ENABLES_FOR_ANY >- && ((IStructuredSelection) selection).size() != descriptor >- .getEnablesFor()) { >+ if (descriptor.getEnablesFor() != ISectionDescriptor.ENABLES_FOR_ANY && >+ ((IStructuredSelection) selection).size() != descriptor >+ .getEnablesFor()) { > /** > * enablesFor does not match the size of the selection, do not > * display section. >@@ -62,31 +69,31 @@ > return false; > } > >- IFilter filter = descriptor.getFilter(); >- >- if (filter != null) { >- for (Iterator i = ((IStructuredSelection) selection).iterator(); i >- .hasNext();) { >- Object object = i.next(); >- >- if (filter != null && filter.select(object) == false) { >- /** >- * filter fails so section does not apply to the selection, >- * do not display section. >- */ >- return false; >- } >- } >- /** >- * filter passes for all objects in the selection. >- */ >- return true; >- } >+ IFilter filter = descriptor.getFilter(); >+ >+ if (filter != null) { >+ for (Iterator i = ((IStructuredSelection) selection).iterator(); i >+ .hasNext();) { >+ Object object = i.next(); >+ >+ if (filter != null && filter.select(object) == false) { >+ /** >+ * filter fails so section does not apply to the >+ * selection, do not display section. >+ */ >+ return false; >+ } >+ } >+ /** >+ * filter passes for all objects in the selection. >+ */ >+ return true; >+ } > > Set effectiveTypes = new HashSet(); > > for (Iterator i = ((IStructuredSelection) selection).iterator(); i >- .hasNext();) { >+ .hasNext();) { > > Object object = i.next(); > >@@ -174,7 +181,7 @@ > } > for (Iterator iter = newInterfaces.iterator(); iter.hasNext();) { > internalComputeInterfaceOrder( >- ((Class) iter.next()).getInterfaces(), result, seen); >+ ((Class) iter.next()).getInterfaces(), result, seen); > } > } > } >Index: src/org/eclipse/ui/internal/views/properties/tabbed/view/TabListContentProvider.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/TabListContentProvider.java,v >retrieving revision 1.1 >diff -u -r1.1 TabListContentProvider.java >--- src/org/eclipse/ui/internal/views/properties/tabbed/view/TabListContentProvider.java 17 Apr 2006 19:03:55 -0000 1.1 >+++ src/org/eclipse/ui/internal/views/properties/tabbed/view/TabListContentProvider.java 1 Aug 2007 18:26:07 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2001, 2006 IBM Corporation and others. >+ * Copyright (c) 2001, 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 >@@ -10,13 +10,12 @@ > *******************************************************************************/ > package org.eclipse.ui.internal.views.properties.tabbed.view; > >-import org.eclipse.jface.util.Assert; >+import org.eclipse.core.runtime.Assert; > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.IStructuredContentProvider; > import org.eclipse.jface.viewers.Viewer; > import org.eclipse.ui.IWorkbenchPart; > >- > /** > * The default implementation of the content provider for the > * tabbed property sheet page's list of tabs. >@@ -32,6 +31,7 @@ > > /** > * Constructor for TabListContentProvider. >+ * @param registry the tabbed property registry. > */ > public TabListContentProvider(TabbedPropertyRegistry registry) { > this.registry = registry; >Index: src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistry.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistry.java,v >retrieving revision 1.2 >diff -u -r1.2 TabbedPropertyRegistry.java >--- src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistry.java 29 Aug 2006 13:27:39 -0000 1.2 >+++ src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistry.java 1 Aug 2007 18:26:07 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2001, 2006 IBM Corporation and others. >+ * Copyright (c) 2001, 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 >@@ -10,7 +10,6 @@ > *******************************************************************************/ > package org.eclipse.ui.internal.views.properties.tabbed.view; > >-import com.ibm.icu.text.MessageFormat; > import java.util.ArrayList; > import java.util.Collections; > import java.util.Comparator; >@@ -29,11 +28,16 @@ > import org.eclipse.ui.internal.views.properties.tabbed.TabbedPropertyViewPlugin; > import org.eclipse.ui.internal.views.properties.tabbed.TabbedPropertyViewStatusCodes; > import org.eclipse.ui.internal.views.properties.tabbed.l10n.TabbedPropertyMessages; >+import org.eclipse.ui.views.properties.tabbed.AbstractTabDescriptor; > import org.eclipse.ui.views.properties.tabbed.IActionProvider; > import org.eclipse.ui.views.properties.tabbed.ISectionDescriptor; > import org.eclipse.ui.views.properties.tabbed.ISectionDescriptorProvider; >+import org.eclipse.ui.views.properties.tabbed.ITabDescriptor; >+import org.eclipse.ui.views.properties.tabbed.ITabDescriptorProvider; > import org.eclipse.ui.views.properties.tabbed.ITypeMapper; > >+import com.ibm.icu.text.MessageFormat; >+ > /** > * Provides information about the tabbed property extension points. Each tabbed > * property registry is associated with a unique contributor ID. >@@ -67,7 +71,11 @@ > > private static final String ATT_LABEL_PROVIDER = "labelProvider"; //$NON-NLS-1$ > >- private static final String ATT_ACTION_PROVIDER = "actionProvider"; //$NON-NLS-1$ >+ private static final String ATT_ACTION_PROVIDER = "actionProvider"; //$NON-NLS-1$ >+ >+ private static final String ATT_SECTION_DESCRIPTOR_PROVIDER = "sectionDescriptorProvider"; //$NON-NLS-1$ >+ >+ private static final String ATT_TAB_DESCRIPTOR_PROVIDER = "tabDescriptorProvider"; //$NON-NLS-1$ > > private static final String TOP = "top"; //$NON-NLS-1$ > >@@ -79,27 +87,29 @@ > > protected ILabelProvider labelProvider; > >- protected IActionProvider actionProvider; >+ protected IActionProvider actionProvider; > > protected ITypeMapper typeMapper; > > protected ISectionDescriptorProvider sectionDescriptorProvider; > >- protected TabDescriptor[] tabDescriptors; >+ protected ITabDescriptorProvider tabDescriptorProvider; > >- protected static final TabDescriptor[] EMPTY_DESCRIPTOR_ARRAY = new TabDescriptor[0]; >+ protected ITabDescriptor[] tabDescriptors; >+ >+ protected static final AbstractTabDescriptor[] EMPTY_DESCRIPTOR_ARRAY = new TabDescriptor[0]; > > /** > * There is one details registry for each contributor type. > */ > protected TabbedPropertyRegistry(String id) { > this.contributorId = id; >- this.propertyCategories = new ArrayList(); >+ this.propertyCategories = new ArrayList(); > IConfigurationElement[] extensions = getConfigurationElements(EXTPT_CONTRIBUTOR); > for (int i = 0; i < extensions.length; i++) { > IConfigurationElement configurationElement = extensions[i]; > String contributor = configurationElement >- .getAttribute(ATT_CONTRIBUTOR_ID); >+ .getAttribute(ATT_CONTRIBUTOR_ID); > if (contributor == null || !id.equals(contributor)) { > continue; > } >@@ -107,15 +117,25 @@ > try { > if (configurationElement.getAttribute(ATT_LABEL_PROVIDER) != null) { > labelProvider = (ILabelProvider) configurationElement >- .createExecutableExtension(ATT_LABEL_PROVIDER); >+ .createExecutableExtension(ATT_LABEL_PROVIDER); >+ } >+ if (configurationElement.getAttribute(ATT_ACTION_PROVIDER) != null) { >+ actionProvider = (IActionProvider) configurationElement >+ .createExecutableExtension(ATT_ACTION_PROVIDER); > } >- if (configurationElement.getAttribute(ATT_ACTION_PROVIDER) != null) { >- actionProvider = (IActionProvider) configurationElement >- .createExecutableExtension(ATT_ACTION_PROVIDER); >- } > if (configurationElement.getAttribute(ATT_TYPE_MAPPER) != null) { > typeMapper = (ITypeMapper) configurationElement >- .createExecutableExtension(ATT_TYPE_MAPPER); >+ .createExecutableExtension(ATT_TYPE_MAPPER); >+ } >+ if (configurationElement >+ .getAttribute(ATT_SECTION_DESCRIPTOR_PROVIDER) != null) { >+ sectionDescriptorProvider = (ISectionDescriptorProvider) configurationElement >+ .createExecutableExtension(ATT_SECTION_DESCRIPTOR_PROVIDER); >+ } >+ if (configurationElement >+ .getAttribute(ATT_TAB_DESCRIPTOR_PROVIDER) != null) { >+ tabDescriptorProvider = (ITabDescriptorProvider) configurationElement >+ .createExecutableExtension(ATT_TAB_DESCRIPTOR_PROVIDER); > } > } catch (CoreException exception) { > handleConfigurationError(id, exception); >@@ -123,7 +143,7 @@ > addPropertyCategories(configurationElement); > } > if (propertyCategories == null || contributorId == null >- || contributorConfigurationElement == null) { >+ || contributorConfigurationElement == null) { > handleConfigurationError(id, null); > this.contributorId = null; > } >@@ -134,12 +154,11 @@ > * > * @param configurationElement > * the configuration element for this contributor. >- * @return the the categories that are valid for this contributor. > */ > private void addPropertyCategories( > IConfigurationElement configurationElement) { > IConfigurationElement[] elements = configurationElement >- .getChildren(ELEMENT_PROPERTY_CATEGORY); >+ .getChildren(ELEMENT_PROPERTY_CATEGORY); > for (int i = 0; i < elements.length; i++) { > IConfigurationElement element = elements[i]; > propertyCategories.add(element.getAttribute(ATT_CATEGORY)); >@@ -157,10 +176,11 @@ > */ > private void handleConfigurationError(String id, CoreException exception) { > String message = MessageFormat.format(CONTRIBUTOR_ERROR, >- new Object[] {id}); >+ new Object[] { id }); > IStatus status = new Status(IStatus.ERROR, TabbedPropertyViewPlugin >- .getPlugin().getBundle().getSymbolicName(), >- TabbedPropertyViewStatusCodes.CONTRIBUTOR_ERROR, message, exception); >+ .getPlugin().getBundle().getSymbolicName(), >+ TabbedPropertyViewStatusCodes.CONTRIBUTOR_ERROR, message, >+ exception); > TabbedPropertyViewPlugin.getPlugin().getLog().log(status); > } > >@@ -174,16 +194,16 @@ > for (int i = 0; i < extensions.length; i++) { > IConfigurationElement extension = extensions[i]; > IConfigurationElement[] sections = extension >- .getChildren(ELEMENT_SECTION); >+ .getChildren(ELEMENT_SECTION); > for (int j = 0; j < sections.length; j++) { > IConfigurationElement section = sections[j]; > ISectionDescriptor descriptor = new SectionDescriptor(section, >- typeMapper); >+ typeMapper); > result.add(descriptor); > } > } > return (ISectionDescriptor[]) result >- .toArray(new ISectionDescriptor[result.size()]); >+ .toArray(new ISectionDescriptor[result.size()]); > } > > /** >@@ -197,9 +217,9 @@ > return new IConfigurationElement[0]; > } > IExtensionPoint point = Platform.getExtensionRegistry() >- .getExtensionPoint( >- TabbedPropertyViewPlugin.getPlugin().getBundle() >- .getSymbolicName(), extensionPointId); >+ .getExtensionPoint( >+ TabbedPropertyViewPlugin.getPlugin().getBundle() >+ .getSymbolicName(), extensionPointId); > IConfigurationElement[] extensions = point.getConfigurationElements(); > List unordered = new ArrayList(extensions.length); > for (int i = 0; i < extensions.length; i++) { >@@ -214,7 +234,7 @@ > unordered.add(extension); > } > return (IConfigurationElement[]) unordered >- .toArray(new IConfigurationElement[unordered.size()]); >+ .toArray(new IConfigurationElement[unordered.size()]); > } > > /** >@@ -230,18 +250,29 @@ > } > > /** >- * Returns property tab descriptors for the given contributor id and object >- * input. The descriptors are sorted using the afterPage attribute. >+ * Returns all section descriptors for the provided selection. >+ * >+ * @param part >+ * the workbench part containing the selection >+ * @param selection >+ * the current selection. >+ * @return all section descriptors. > */ >- public TabDescriptor[] getTabDescriptors(IWorkbenchPart part, >+ public ITabDescriptor[] getTabDescriptors(IWorkbenchPart part, > ISelection selection) { > if (selection == null || selection.isEmpty()) { > return EMPTY_DESCRIPTOR_ARRAY; > } > >- TabDescriptor[] allDescriptors = getAllTabDescriptors(); >- TabDescriptor[] result = filterTabDescriptors(allDescriptors, part, >- selection); >+ ITabDescriptor[] allDescriptors = null; >+ if (tabDescriptorProvider == null) { >+ allDescriptors = getAllTabDescriptors(); >+ } else { >+ allDescriptors = tabDescriptorProvider.getTabDescriptors(part, selection); >+ } >+ >+ ITabDescriptor[] result = filterTabDescriptors(allDescriptors, part, >+ selection); > return result; > } > >@@ -249,12 +280,13 @@ > * Filters out the tab descriptors that do not have any sections for the > * given input. > */ >- protected TabDescriptor[] filterTabDescriptors(TabDescriptor[] descriptors, >- IWorkbenchPart part, ISelection selection) { >+ protected ITabDescriptor[] filterTabDescriptors( >+ ITabDescriptor[] descriptors, IWorkbenchPart part, >+ ISelection selection) { > List result = new ArrayList(); > for (int i = 0; i < descriptors.length; i++) { >- TabDescriptor descriptor = adaptDescriptorFor(descriptors[i], part, >- selection); >+ ITabDescriptor descriptor = adaptDescriptorFor(descriptors[i], >+ part, selection); > if (!descriptor.getSectionDescriptors().isEmpty()) { > result.add(descriptor); > } >@@ -262,15 +294,15 @@ > if (result.size() == 0) { > return EMPTY_DESCRIPTOR_ARRAY; > } >- return (TabDescriptor[]) result >- .toArray(new TabDescriptor[result.size()]); >+ return (ITabDescriptor[]) result >+ .toArray(new ITabDescriptor[result.size()]); > } > > /** > * Given a property tab descriptor remove all its section descriptors that > * do not apply to the given input object. > */ >- protected TabDescriptor adaptDescriptorFor(TabDescriptor target, >+ protected ITabDescriptor adaptDescriptorFor(ITabDescriptor target, > IWorkbenchPart part, ISelection selection) { > List filteredSectionDescriptors = new ArrayList(); > List descriptors = target.getSectionDescriptors(); >@@ -280,7 +312,8 @@ > filteredSectionDescriptors.add(descriptor); > } > } >- TabDescriptor result = (TabDescriptor) target.clone(); >+ AbstractTabDescriptor result = (AbstractTabDescriptor) ((AbstractTabDescriptor) target) >+ .clone(); > result.setSectionDescriptors(filteredSectionDescriptors); > return result; > } >@@ -289,7 +322,7 @@ > * Reads property tab extensions. Returns all tab descriptors for the > * current contributor id or an empty array if none is found. > */ >- protected TabDescriptor[] getAllTabDescriptors() { >+ protected ITabDescriptor[] getAllTabDescriptors() { > if (tabDescriptors == null) { > List temp = readTabDescriptors(); > populateWithSectionDescriptors(temp); >@@ -349,10 +382,10 @@ > } > // could not append the section to any of the existing tabs - log error > String message = MessageFormat.format(NO_TAB_ERROR, new Object[] { >- section.getId(), section.getTargetTab()}); >+ section.getId(), section.getTargetTab() }); > IStatus status = new Status(IStatus.ERROR, TabbedPropertyViewPlugin >- .getPlugin().getBundle().getSymbolicName(), >- TabbedPropertyViewStatusCodes.NO_TAB_ERROR, message, null); >+ .getPlugin().getBundle().getSymbolicName(), >+ TabbedPropertyViewStatusCodes.NO_TAB_ERROR, message, null); > TabbedPropertyViewPlugin.getPlugin().getLog().log(status); > } > >@@ -367,10 +400,10 @@ > TabDescriptor two = (TabDescriptor) arg1; > String categoryOne = one.getCategory(); > String categoryTwo = two.getCategory(); >- int categoryOnePosition = getIndex(propertyCategories.toArray(), >- categoryOne); >- int categoryTwoPosition = getIndex(propertyCategories.toArray(), >- categoryTwo); >+ int categoryOnePosition = getIndex( >+ propertyCategories.toArray(), categoryOne); >+ int categoryTwoPosition = getIndex( >+ propertyCategories.toArray(), categoryTwo); > return categoryOnePosition - categoryTwoPosition; > } > }); >@@ -388,12 +421,12 @@ > int categoryIndex = 0; > for (int i = 0; i < propertyCategories.size(); i++) { > List categoryList = new ArrayList(); >- String category = (String)propertyCategories.get(i); >+ String category = (String) propertyCategories.get(i); > int topOfCategory = categoryIndex; > int endOfCategory = categoryIndex; > while (endOfCategory < tabs.size() >- && ((TabDescriptor) tabs.get(endOfCategory)).getCategory() >- .equals(category)) { >+ && ((TabDescriptor) tabs.get(endOfCategory)).getCategory() >+ .equals(category)) { > endOfCategory++; > } > for (int j = topOfCategory; j < endOfCategory; j++) { >@@ -444,23 +477,12 @@ > return labelProvider; > } > >- /** >- * Gets the action provider for the contributor. >- * >- * @return the action provider for the contributor. >- */ >- public IActionProvider getActionProvider() { >- return actionProvider; >- } >- > /** >- * Sets the section descriptor provider for the contributor. >+ * Gets the action provider for the contributor. > * >- * @param sectionDescriptorProvider >- * the section descriptor provider for the contributor. >+ * @return the action provider for the contributor. > */ >- public void setSectionDescriptorProvider( >- ISectionDescriptorProvider sectionDescriptorProvider) { >- this.sectionDescriptorProvider = sectionDescriptorProvider; >+ public IActionProvider getActionProvider() { >+ return actionProvider; > } > } >Index: .settings/org.eclipse.jdt.ui.prefs >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/.settings/org.eclipse.jdt.ui.prefs,v >retrieving revision 1.4 >diff -u -r1.4 org.eclipse.jdt.ui.prefs >--- .settings/org.eclipse.jdt.ui.prefs 12 Sep 2006 13:10:33 -0000 1.4 >+++ .settings/org.eclipse.jdt.ui.prefs 1 Aug 2007 18:26:06 -0000 >@@ -2,4 +2,4 @@ > eclipse.preferences.version=1 > internal.default.compliance=user > org.eclipse.jdt.ui.javadoc=true >-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return Returns the ${bare_field_name}.\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} The ${bare_field_name} to set.\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\n * Copyright (c) ${year} IBM Corporation and others.\n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * IBM Corporation - initial API and implementation\n ******************************************************************************/\n</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @since 3.3\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template></templates> >+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return Returns the ${bare_field_name}.\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} The ${bare_field_name} to set.\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\n * Copyright (c) ${year} IBM Corporation and others.\n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * IBM Corporation - initial API and implementation\n ******************************************************************************/\n</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @since 3.4\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template></templates> >Index: src/org/eclipse/ui/views/properties/tabbed/AbstractSectionDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/views/properties/tabbed/AbstractSectionDescriptor.java >diff -N src/org/eclipse/ui/views/properties/tabbed/AbstractSectionDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/views/properties/tabbed/AbstractSectionDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,76 @@ >+/******************************************************************************* >+ * 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.views.properties.tabbed; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.jface.viewers.IFilter; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyRegistryClassSectionFilter; >+ >+/** >+ * An abstract implementation of a section descriptor for the tabbed property >+ * view. >+ * >+ * @author Anthony Hunter >+ * @since 3.4 >+ */ >+public abstract class AbstractSectionDescriptor implements ISectionDescriptor { >+ >+ private TabbedPropertyRegistryClassSectionFilter classFilter; >+ >+ /** >+ * Constructor for AbstractSectionDescriptor. >+ * >+ * @param typeMapper >+ * the type mapper for the section. >+ */ >+ public AbstractSectionDescriptor(ITypeMapper typeMapper) { >+ super(); >+ classFilter = new TabbedPropertyRegistryClassSectionFilter(typeMapper); >+ } >+ >+ /* >+ * @see org.eclipse.ui.views.properties.tabbed.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, >+ * org.eclipse.jface.viewers.ISelection) >+ */ >+ public boolean appliesTo(IWorkbenchPart part, ISelection selection) { >+ return classFilter.appliesToSelection(this, selection); >+ } >+ >+ /* >+ * @see org.eclipse.ui.views.properties.tabbed.ISectionDescriptor#getAfterSection() >+ */ >+ public String getAfterSection() { >+ return TOP; >+ } >+ >+ /* >+ * @see org.eclipse.ui.views.properties.tabbed.ISectionDescriptor#getEnablesFor() >+ */ >+ public int getEnablesFor() { >+ return ENABLES_FOR_ANY; >+ } >+ >+ /* >+ * @see org.eclipse.ui.views.properties.tabbed.ISectionDescriptor#getFilter() >+ */ >+ public IFilter getFilter() { >+ return null; >+ } >+ >+ public List getInputTypes() { >+ return new ArrayList(); >+ } >+} >Index: src/org/eclipse/ui/views/properties/tabbed/AbstractTabDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/views/properties/tabbed/AbstractTabDescriptor.java >diff -N src/org/eclipse/ui/views/properties/tabbed/AbstractTabDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/views/properties/tabbed/AbstractTabDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,178 @@ >+/******************************************************************************* >+ * 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.views.properties.tabbed; >+ >+import java.util.ArrayList; >+import java.util.Iterator; >+import java.util.List; >+ >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.ui.internal.views.properties.tabbed.TabbedPropertyViewPlugin; >+ >+/** >+ * An abstract implementation of a tab descriptor for the tabbed property view. >+ * >+ * @author Anthony Hunter >+ * @since 3.4 >+ */ >+public abstract class AbstractTabDescriptor implements ITabDescriptor, >+ Cloneable { >+ >+ private List sectionDescriptors; >+ >+ /** >+ * Constructor for AbstractTabDescriptor. >+ */ >+ public AbstractTabDescriptor() { >+ super(); >+ sectionDescriptors = new ArrayList(5); >+ } >+ >+ /* >+ * @see java.lang.Object#clone() >+ */ >+ public Object clone() { >+ try { >+ return super.clone(); >+ } catch (CloneNotSupportedException exception) { >+ IStatus status = new Status(IStatus.ERROR, TabbedPropertyViewPlugin >+ .getPlugin().getBundle().getSymbolicName(), 666, exception >+ .getMessage(), exception); >+ TabbedPropertyViewPlugin.getPlugin().getLog().log(status); >+ } >+ return null; >+ } >+ >+ /* >+ * @see org.eclipse.ui.views.properties.tabbed.ITabDescriptor#createTab() >+ */ >+ public TabContents createTab() { >+ List sections = new ArrayList(getSectionDescriptors().size()); >+ for (Iterator iter = getSectionDescriptors().iterator(); iter.hasNext();) { >+ ISectionDescriptor descriptor = (ISectionDescriptor) iter.next(); >+ ISection section = descriptor.getSectionClass(); >+ sections.add(section); >+ } >+ TabContents tab = new TabContents(); >+ tab.setSections((ISection[]) sections.toArray(new ISection[sections >+ .size()])); >+ return tab; >+ } >+ >+ /* >+ * @see java.lang.Object#equals(java.lang.Object) >+ */ >+ public boolean equals(Object object) { >+ if (this == object) { >+ return true; >+ } >+ >+ if (this.getClass() == object.getClass()) { >+ AbstractTabDescriptor descriptor = (AbstractTabDescriptor) object; >+ if (this.getCategory().equals(descriptor.getCategory()) && >+ this.getId().equals(descriptor.getId()) && >+ this.getSectionDescriptors().size() == descriptor >+ .getSectionDescriptors().size()) { >+ >+ Iterator i = this.getSectionDescriptors().iterator(); >+ Iterator j = descriptor.getSectionDescriptors().iterator(); >+ >+ // the order is important here - so as long as the sizes of the >+ // lists are the same and id of the section at the same >+ // positions are the same - the lists are the same >+ while (i.hasNext()) { >+ ISectionDescriptor source = (ISectionDescriptor) i.next(); >+ ISectionDescriptor target = (ISectionDescriptor) j.next(); >+ if (!source.getId().equals(target.getId())) { >+ return false; >+ } >+ } >+ >+ return true; >+ } >+ >+ } >+ >+ return false; >+ } >+ >+ /* >+ * @see org.eclipse.ui.views.properties.tabbed.ITabDescriptor#getAfterTab() >+ */ >+ public String getAfterTab() { >+ return TOP; >+ } >+ >+ /* >+ * @see org.eclipse.ui.views.properties.tabbed.ITabItem#getImage() >+ */ >+ public Image getImage() { >+ return null; >+ } >+ >+ /** >+ * Get the list of section descriptors for the tab. >+ * >+ * @return the list of section descriptors for the tab. >+ */ >+ public List getSectionDescriptors() { >+ return sectionDescriptors; >+ } >+ >+ /* >+ * @see org.eclipse.ui.views.properties.tabbed.ITabItem#getText() >+ */ >+ public String getText() { >+ return getLabel(); >+ } >+ >+ /* >+ * @see java.lang.Object#hashCode() >+ */ >+ public int hashCode() { >+ >+ int hashCode = getCategory().hashCode(); >+ hashCode ^= getId().hashCode(); >+ Iterator i = this.getSectionDescriptors().iterator(); >+ while (i.hasNext()) { >+ ISectionDescriptor section = (ISectionDescriptor) i.next(); >+ hashCode ^= section.getId().hashCode(); >+ } >+ return hashCode; >+ } >+ >+ /* >+ * @see org.eclipse.ui.views.properties.tabbed.ITabItem#isIndented() >+ */ >+ public boolean isIndented() { >+ return false; >+ } >+ >+ /* >+ * @see org.eclipse.ui.views.properties.tabbed.ITabItem#isSelected() >+ */ >+ public boolean isSelected() { >+ return false; >+ } >+ >+ /** >+ * Set the list of section descriptors for the tab. >+ * >+ * @param sectionDescriptors >+ * the list of section descriptors for the tab. >+ */ >+ public void setSectionDescriptors(List sectionDescriptors) { >+ this.sectionDescriptors = sectionDescriptors; >+ } >+} >Index: src/org/eclipse/ui/views/properties/tabbed/ITabDescriptor.java >=================================================================== >RCS file: src/org/eclipse/ui/views/properties/tabbed/ITabDescriptor.java >diff -N src/org/eclipse/ui/views/properties/tabbed/ITabDescriptor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/views/properties/tabbed/ITabDescriptor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,77 @@ >+/******************************************************************************* >+ * 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.views.properties.tabbed; >+ >+import java.util.List; >+ >+/** >+ * Represents a tab descriptor for the tabbed property view. >+ * <p> >+ * This interface should not be extended or implemented. New instances should be >+ * created using <code>AbstractTabDescriptor</code>. >+ * </p> >+ * >+ * @author Anthony Hunter >+ * @since 3.4 >+ */ >+public interface ITabDescriptor extends ITabItem { >+ >+ /** >+ * If afterTab is not specified in the descriptor, we default to be the top >+ * tab. >+ */ >+ public static final String TOP = "top"; //$NON-NLS-1$ >+ >+ /** >+ * Instantiate this tab's sections. >+ * >+ * @return >+ */ >+ public TabContents createTab(); >+ >+ /** >+ * Get the identifier of the tab after which this tab should be displayed. >+ * When two or more tabs belong to the same category, they are sorted by the >+ * after tab values. >+ * >+ * @return the identifier of the tab. >+ */ >+ public String getAfterTab(); >+ >+ /** >+ * Get the category this tab belongs to. >+ * >+ * @return Get the category this tab belongs to. >+ */ >+ public String getCategory(); >+ >+ /** >+ * Get the unique identifier for the tab. >+ * >+ * @return the unique identifier for the tab. >+ */ >+ public String getId(); >+ >+ /** >+ * Get the text label for the tab. >+ * >+ * @return the text label for the tab. >+ */ >+ public String getLabel(); >+ >+ /** >+ * Get the list of section descriptors for the tab. >+ * >+ * @return the list of section descriptors for the tab. >+ */ >+ public List getSectionDescriptors(); >+} >Index: src/org/eclipse/ui/views/properties/tabbed/TabContents.java >=================================================================== >RCS file: src/org/eclipse/ui/views/properties/tabbed/TabContents.java >diff -N src/org/eclipse/ui/views/properties/tabbed/TabContents.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/views/properties/tabbed/TabContents.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,248 @@ >+/******************************************************************************* >+ * 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.views.properties.tabbed; >+ >+import org.eclipse.core.runtime.ISafeRunnable; >+import org.eclipse.jface.util.SafeRunnable; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.FillLayout; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.ui.IWorkbenchPart; >+ >+/** >+ * A property tab is composed by one or more property sections and is used to >+ * categorize sections. >+ * >+ * @author Anthony Hunter >+ * @since 3.4 >+ */ >+public final class TabContents { >+ >+ private ISection[] sections; >+ >+ private boolean controlsCreated; >+ >+ /** >+ * >+ */ >+ public TabContents() { >+ controlsCreated = false; >+ } >+ >+ /** >+ * Retrieve a numbered index for the section. >+ * @param section the section. >+ * @return the section index. >+ */ >+ public int getSectionIndex(ISection section) { >+ for (int i = 0; i < sections.length; i++) { >+ if (section == sections[i]) { >+ return i; >+ } >+ } >+ return -1; >+ } >+ >+ /** >+ * Retrieve the section at a numbered index. >+ * @param i a numbered index. >+ * @return the section. >+ */ >+ public ISection getSectionAtIndex(int i) { >+ if (i >= 0 && i < sections.length) { >+ return sections[i]; >+ } >+ return null; >+ } >+ >+ /** >+ * Retrieve the sections on the tab. >+ * >+ * @return the sections on the tab. >+ */ >+ public ISection[] getSections() { >+ return sections; >+ } >+ >+ /** >+ * Creates page's sections controls. >+ * >+ * @param parent >+ * @param page >+ */ >+ public void createControls(Composite parent, >+ final TabbedPropertySheetPage page) { >+ Composite pageComposite = page.getWidgetFactory().createComposite( >+ parent, SWT.NO_FOCUS); >+ GridLayout layout = new GridLayout(); >+ layout.marginWidth = 0; >+ layout.marginHeight = 0; >+ layout.verticalSpacing = 0; >+ pageComposite.setLayout(layout); >+ >+ for (int i = 0; i < sections.length; i++) { >+ final ISection section = sections[i]; >+ final Composite sectionComposite = page.getWidgetFactory() >+ .createComposite(pageComposite, SWT.NO_FOCUS); >+ sectionComposite.setLayout(new FillLayout()); >+ int style = (section.shouldUseExtraSpace()) ? GridData.FILL_BOTH >+ : GridData.FILL_HORIZONTAL; >+ GridData data = new GridData(style); >+ data.heightHint = section.getMinimumHeight(); >+ sectionComposite.setLayoutData(data); >+ >+ ISafeRunnable runnable = new ISafeRunnable() { >+ >+ public void run() >+ throws Exception { >+ section.createControls(sectionComposite, page); >+ } >+ >+ public void handleException(Throwable exception) { >+ /* not used */ >+ } >+ }; >+ SafeRunnable.run(runnable); >+ } >+ controlsCreated = true; >+ } >+ >+ /** >+ * Dispose of page's sections controls. >+ */ >+ public void dispose() { >+ for (int i = 0; i < sections.length; i++) { >+ final ISection section = sections[i]; >+ ISafeRunnable runnable = new ISafeRunnable() { >+ >+ public void run() >+ throws Exception { >+ section.dispose(); >+ } >+ >+ public void handleException(Throwable exception) { >+ /* not used */ >+ } >+ }; >+ SafeRunnable.run(runnable); >+ } >+ } >+ >+ /** >+ * Sends the lifecycle event to the page's sections. >+ */ >+ public void aboutToBeShown() { >+ for (int i = 0; i < sections.length; i++) { >+ final ISection section = sections[i]; >+ ISafeRunnable runnable = new ISafeRunnable() { >+ >+ public void run() >+ throws Exception { >+ section.aboutToBeShown(); >+ } >+ >+ public void handleException(Throwable exception) { >+ /* not used */ >+ } >+ }; >+ SafeRunnable.run(runnable); >+ } >+ } >+ >+ /** >+ * Sends the lifecycle event to the page's sections. >+ */ >+ public void aboutToBeHidden() { >+ for (int i = 0; i < sections.length; i++) { >+ final ISection section = sections[i]; >+ ISafeRunnable runnable = new ISafeRunnable() { >+ >+ public void run() >+ throws Exception { >+ section.aboutToBeHidden(); >+ } >+ >+ public void handleException(Throwable exception) { >+ /* not used */ >+ } >+ }; >+ SafeRunnable.run(runnable); >+ } >+ } >+ >+ /** >+ * Sets page's sections input objects. >+ * >+ * @param part >+ * @param selection >+ */ >+ public void setInput(final IWorkbenchPart part, final ISelection selection) { >+ for (int i = 0; i < sections.length; i++) { >+ final ISection section = sections[i]; >+ ISafeRunnable runnable = new ISafeRunnable() { >+ >+ public void run() >+ throws Exception { >+ section.setInput(part, selection); >+ } >+ >+ public void handleException(Throwable throwable) { >+ throwable.printStackTrace(); >+ } >+ }; >+ SafeRunnable.run(runnable); >+ } >+ } >+ >+ /** >+ * Set the sections for the tab. >+ * >+ * @param sections the sections for the tab. >+ */ >+ public void setSections(ISection[] sections) { >+ this.sections = sections; >+ } >+ >+ /** >+ * Determine if the controls have been created. >+ * >+ * @return <code>true</code> if controls have been created. >+ */ >+ public boolean controlsHaveBeenCreated() { >+ return controlsCreated; >+ } >+ >+ /** >+ * If controls have been created, refresh all sections on the page. >+ */ >+ public void refresh() { >+ if (controlsCreated) { >+ for (int i = 0; i < sections.length; i++) { >+ final ISection section = sections[i]; >+ ISafeRunnable runnable = new ISafeRunnable() { >+ >+ public void run() >+ throws Exception { >+ section.refresh(); >+ } >+ >+ public void handleException(Throwable throwable) { >+ throwable.printStackTrace(); >+ } >+ }; >+ SafeRunnable.run(runnable); >+ } >+ } >+ } >+} >Index: src/org/eclipse/ui/views/properties/tabbed/ITabDescriptorProvider.java >=================================================================== >RCS file: src/org/eclipse/ui/views/properties/tabbed/ITabDescriptorProvider.java >diff -N src/org/eclipse/ui/views/properties/tabbed/ITabDescriptorProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/views/properties/tabbed/ITabDescriptorProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,35 @@ >+/******************************************************************************* >+ * 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.views.properties.tabbed; >+ >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.ui.IWorkbenchPart; >+ >+/** >+ * Represents a tab descriptor provider for the tabbed property view. >+ * >+ * @author Anthony Hunter >+ * @since 3.4 >+ */ >+public interface ITabDescriptorProvider { >+ >+ /** >+ * Returns all tab descriptors. >+ * >+ * @param part >+ * the workbench part containing the selection >+ * @param selection >+ * the current selection. >+ * @return all section descriptors. >+ */ >+ public ITabDescriptor[] getTabDescriptors(IWorkbenchPart part, >+ ISelection selection); >+}
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 131855
:
69495
|
70363
|
73601
|
73602
|
73603
| 75144 |
75227
|
77282
|
77284