Project: Eclipse_Platform_UI
Bug 6902 Perps ext. to add new view fails because of folders.
Reported: 2001-12-13 13:53:05 | Status: resolved fixed

This is using build 2001-12-04 on Windows 2000 Using the perspectiveExtension extension point, a view may not be added properly if the referenced view is inside a tab folder. For example, in the Debug perspective, if I want to add a view to the left to the Properties view, it will fail because the Properties view is inside a tab folder with the view Outline. Looking at the code, in PerspectiveExtension.processView, it calls PageLayout.addView, which calls PageLayout.getRefPart. This getRefPart method returns null cause the ref part id for the Properties view is not in the map (only the part tab folder containing the Properties view is in the map). Asking the developer to specify the part tab folder id instead of the view id is not recommended as that is internal code to the perspective. Best if PageLayout was capable of finding the part inside the part tab folder. Below is a plugin.xml file and view source code. Simply create a Java project with the name com.company.myplugin and set the classpath (core, swt, ui, etc) --------- plugin.xml <?xml version="1.0" encoding="UTF-8"?> <!-- File written by PDE 1.0 --> <plugin id="com.company.myplugin" name="My Plugin" version="1.0.0" provider-name="COMPANY"> <requires> <import plugin="org.eclipse.core.runtime"/> <import plugin="org.eclipse.core.resources"/> <import plugin="org.eclipse.ui"/> <import plugin="org.eclipse.swt"/> <import plugin="org.eclipse.core.boot"/> </requires> <runtime> <library name="myplugin.jar"/> </runtime> <extension point="org.eclipse.ui.perspectiveExtensions"> <perspectiveExtension targetID="org.eclipse.debug.ui.DebugPerspective"> <view id="com.company.myplugin.MyView" relative="org.eclipse.ui.views.PropertySheet" relationship="right" ratio="0.5"> </view> <viewShortcut id="com.company.myplugin.MyView"> </viewShortcut> </perspectiveExtension> </extension> <extension point="org.eclipse.ui.views"> <view id="com.company.myplugin.MyView" name="My Plugin" class="com.company.myplugin.MyViewClass" category="org.eclipse.debug.ui"> </view> </extension> </plugin> ---------plugin.xml **************************************** **************************************** -------source code package com.company.myplugin; import org.eclipse.swt.widgets.*; import org.eclipse.ui.part.ViewPart; public class MyViewClass extends ViewPart { private Label label; public MyViewClass() { super(); } public void setFocus() { label.setFocus(); } public void createPartControl(Composite parent) { label = new Label(parent, 0); label.setText("Hello World"); } } -------- source code

Files changed in fix:
bundles/org.eclipse.ui/Eclipse UI/org/eclipse/ui/internal/FolderLayout.java bundles/org.eclipse.ui/Eclipse UI/org/eclipse/ui/internal/PageLayout.java