1 11 package org.eclipse.ui.internal.dialogs; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.IConfigurationElement; 15 import org.eclipse.core.runtime.IStatus; 16 import org.eclipse.ui.IWorkbenchPreferencePage; 17 import org.eclipse.ui.PlatformUI; 18 import org.eclipse.ui.internal.WorkbenchMessages; 19 import org.eclipse.ui.internal.WorkbenchPlugin; 20 import org.eclipse.ui.internal.misc.StatusUtil; 21 import org.eclipse.ui.internal.preferences.WorkbenchPreferenceExtensionNode; 22 import org.eclipse.ui.internal.registry.CategorizedPageRegistryReader; 23 import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants; 24 import org.eclipse.ui.statushandlers.StatusManager; 25 26 30 public class WorkbenchPreferenceNode extends WorkbenchPreferenceExtensionNode { 31 32 37 public WorkbenchPreferenceNode(String nodeId, IConfigurationElement element) { 38 super(nodeId, element); 39 } 40 41 44 public void createPage() { 45 IWorkbenchPreferencePage page; 46 try { 47 page = (IWorkbenchPreferencePage) WorkbenchPlugin.createExtension( 48 getConfigurationElement(), IWorkbenchRegistryConstants.ATT_CLASS); 49 } catch (CoreException e) { 50 IStatus errStatus = StatusUtil.newStatus(e.getStatus(), WorkbenchMessages.PreferenceNode_errorMessage); 53 StatusManager.getManager().handle(errStatus, StatusManager.SHOW); 54 page = new ErrorPreferencePage(); 55 } 56 57 page.init(PlatformUI.getWorkbench()); 58 if (getLabelImage() != null) { 59 page.setImageDescriptor(getImageDescriptor()); 60 } 61 page.setTitle(getLabelText()); 62 setPage(page); 63 } 64 65 69 public String getCategory() { 70 return getConfigurationElement().getAttribute( 71 CategorizedPageRegistryReader.ATT_CATEGORY); 72 } 73 } 74 | Popular Tags |