# HG changeset patch # User stechong # Date 1280944523 18000 # Node ID bd89f0317b138f20a5221ac01290446a03da046c # Parent 29124e454f1e1c8eae66996c58136127655faf35 Updated SDK preference page to make it more portal friendly. diff -r 29124e454f1e -r bd89f0317b13 core/com.nokia.carbide.cpp.sdk.ui/plugin.xml --- a/core/com.nokia.carbide.cpp.sdk.ui/plugin.xml Tue Aug 03 16:47:39 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/plugin.xml Wed Aug 04 12:55:23 2010 -0500 @@ -59,7 +59,7 @@ class="com.nokia.carbide.cpp.sdk.ui.SDKPreferencesPortalPageLayer" order="1" pageId="com.nokia.carbide.discovery.ui.kitsPage" - title="SDKs"> + title="Symbian SDKs"> diff -r 29124e454f1e -r bd89f0317b13 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPreferencePage.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPreferencePage.java Tue Aug 03 16:47:39 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPreferencePage.java Wed Aug 04 12:55:23 2010 -0500 @@ -252,7 +252,10 @@ * @see org.eclipse.jface.preference.PreferencePage#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl(Composite parent){ - if (sdkMgr == null){ + if (sdkMgr == null) { + sdkMgr = SDKCorePlugin.getSDKManager(); + } + if (sdkMgr == null) { return; } @@ -269,8 +272,10 @@ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) */ public void init(IWorkbench workbench) { - sdkMgr = SDKCorePlugin.getSDKManager(); - if (sdkMgr != null){ + if (sdkMgr == null) { + sdkMgr = SDKCorePlugin.getSDKManager(); + } + if (sdkMgr != null) { sdkList = sdkMgr.getSDKList(); } } @@ -281,7 +286,7 @@ */ public boolean performOk() { // Remember which SDK is enabled - for (ISymbianSDK sdk : sdkMgr.getSDKList()){ + for (ISymbianSDK sdk : sdkMgr.getSDKList()) { ((SymbianSDK)sdk).setEnabled(false); } Object[] sdkObjects = sdkListTableViewer.getCheckedElements(); @@ -392,7 +397,7 @@ } else if (e.getSource().equals(propertiesButton)) { handlePropertiesButton(); } else if (e.getSource().equals(rescanButton)) { - handleRescanButton(); + handleRescanButton(false); } } }; @@ -467,7 +472,7 @@ locationCol.getColumn().setWidth(170); } - private void handleAddButton() { + public void handleAddButton() { AddSDKDialog dialog = new AddSDKDialog(getShell()); if (dialog.open() == AddSDKDialog.OK){ sdkList = sdkMgr.getSDKList(); @@ -478,7 +483,7 @@ } } - private void handleDeleteButton() { + public void handleDeleteButton() { ISymbianSDK sdk = (ISymbianSDK)((IStructuredSelection)sdkListTableViewer.getSelection()).getFirstElement(); int index = sdkListTableViewer.getTable().getSelectionIndex(); if (sdk != null){ @@ -495,7 +500,7 @@ } } - private void handlePropertiesButton() { + public void handlePropertiesButton() { ISymbianSDK sdk = (ISymbianSDK)((IStructuredSelection)sdkListTableViewer.getSelection()).getFirstElement(); int index = sdkListTableViewer.getTable().getSelectionIndex(); if (sdk != null){ @@ -507,7 +512,7 @@ } } - private void handleRescanButton() { + public void handleRescanButton(boolean fromPortalPage) { // forcible rescan; dump cache SymbianBuildContextDataCache.refreshForSDKs(null); startRescanning(); @@ -532,7 +537,7 @@ rescanButton.setEnabled(true); } - private void selectSDKEntry(int index) { + public void selectSDKEntry(int index) { ISymbianSDK sdk = (ISymbianSDK)sdkListTableViewer.getElementAt(index); if (sdk != null){ sdkListTableViewer.setSelection(new StructuredSelection(sdk), true); @@ -635,4 +640,14 @@ } } + public void updateForPortalLayer() { + addButton.setVisible(false); + deleteButton.setVisible(false); + propertiesButton.setVisible(false); + rescanButton.setVisible(false); + getApplyButton().setVisible(false); + GridLayout gridLayout = new GridLayout(); + sdkListTableViewer.getTable().getParent().setLayout(gridLayout); + } + } \ No newline at end of file diff -r 29124e454f1e -r bd89f0317b13 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties Tue Aug 03 16:47:39 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties Wed Aug 04 12:55:23 2010 -0500 @@ -22,6 +22,7 @@ SDKPreferencePage.SDK_Table_Location_Column_Label=Location SDKPreferencePage.Invalid_Location_Message=Invalid location. '\\epoc32\\' does not exist at specified location. SDKPreferencePage.Invalid_SDK_Message=Invalid SDK. OS version {0} not supported. Must be verison 9.4 or higher. +SDKPreferencePage.Manage_SDKs_Label=Manage SDKs BuildPlatformFilterPage.Select_Platforms_Help=Select which platforms are visible when creating projects or new build configurations. BuildPlatformFilterPage.Specify_Platforms_Help=Specifies platforms to be displayed for OS 9.x and 8.1b diff -r 29124e454f1e -r bd89f0317b13 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/SDKPreferencesPortalPageLayer.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/SDKPreferencesPortalPageLayer.java Tue Aug 03 16:47:39 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/SDKPreferencesPortalPageLayer.java Wed Aug 04 12:55:23 2010 -0500 @@ -16,11 +16,17 @@ */ package com.nokia.carbide.cpp.sdk.ui; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PlatformUI; +import com.nokia.carbide.cpp.internal.sdk.ui.Messages; import com.nokia.carbide.cpp.internal.sdk.ui.SDKPreferencePage; import com.nokia.carbide.internal.discovery.ui.extension.IActionBar; import com.nokia.carbide.internal.discovery.ui.extension.IActionUIUpdater; @@ -29,11 +35,32 @@ @SuppressWarnings("restriction") public class SDKPreferencesPortalPageLayer implements IPortalPageLayer { + protected class SDKActionBar implements IActionBar { + private IAction[] actions; + + public SDKActionBar(IEditorPart part) { + actions = makeActions(part); + } + + public String getTitle() { + return Messages.getString("SDKPreferencePage.Manage_SDKs_Label"); + } + + public IAction[] getActions() { + return actions; + } + + public String[] getHighlightedActionIds() { + return null; + } + } + private SDKPreferencePage preferencePage; public Control createControl(Composite parent, IEditorPart part) { preferencePage = new SDKPreferencePage(); preferencePage.createControl(parent); + preferencePage.updateForPortalLayer(); return preferencePage.getControl(); } @@ -42,11 +69,53 @@ } public IActionBar[] createCommandBars(IEditorPart part, IActionUIUpdater updater) { - return null; + return new IActionBar[] { new SDKActionBar(part) }; } public void dispose() { preferencePage.dispose(); } + protected IAction[] makeActions(final IEditorPart part) { + List actions = new ArrayList(); + IAction action; + + // Add SDK + action = new Action(Messages.getString("SDKPreferencePage.Add_Button_Label")) { + public void run() { + preferencePage.handleAddButton(); + } + }; + action.setToolTipText(Messages.getString("SDKPreferencePage.Add_Button_ToolTip")); + actions.add(action); + + // Delete SDK + action = new Action(Messages.getString("SDKPreferencePage.Delete_Button_Label")) { + public void run() { + preferencePage.handleDeleteButton(); + } + }; + action.setToolTipText(Messages.getString("SDKPreferencePage.Delete_Button_ToolTip")); + actions.add(action); + + // SDK Properties + action = new Action(Messages.getString("SDKPreferencePage.Properties_Button_Label")) { + public void run() { + preferencePage.handlePropertiesButton(); + } + }; + action.setToolTipText(Messages.getString("SDKPreferencePage.Properties_Button_ToolTip")); + actions.add(action); + + // Rescan SDKs + action = new Action(Messages.getString("SDKPreferencePage.Rescan_Button_Label")) { + public void run() { + preferencePage.handleRescanButton(true); + } + }; + action.setToolTipText(Messages.getString("SDKPreferencePage.Rescan_Button_ToolTip")); + actions.add(action); + + return (IAction[]) actions.toArray(new IAction[actions.size()]); + } }