# HG changeset patch # User dadubrow # Date 1279742022 18000 # Node ID cd8159f371c703b940591bb1b8421dc46b5972f5 # Parent a53047bc0aba6ad0cdc18d29f3268c64b1611397 multiple changes: + export packages + support for highlighted actions + externalize strings diff -r a53047bc0aba -r cd8159f371c7 core/com.nokia.carbide.discovery.ui/META-INF/MANIFEST.MF --- a/core/com.nokia.carbide.discovery.ui/META-INF/MANIFEST.MF Wed Jul 21 14:13:29 2010 -0500 +++ b/core/com.nokia.carbide.discovery.ui/META-INF/MANIFEST.MF Wed Jul 21 14:53:42 2010 -0500 @@ -25,3 +25,8 @@ Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-Vendor: Nokia +Export-Package: com.nokia.carbide.discovery.ui;x-internal:=true, + com.nokia.carbide.internal.discovery.ui.command;x-internal:=true, + com.nokia.carbide.internal.discovery.ui.editor;x-internal:=true, + com.nokia.carbide.internal.discovery.ui.extension;x-internal:=true, + com.nokia.carbide.internal.discovery.ui.view;x-internal:=true diff -r a53047bc0aba -r cd8159f371c7 core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/Activator.java --- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/Activator.java Wed Jul 21 14:13:29 2010 -0500 +++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/Activator.java Wed Jul 21 14:53:42 2010 -0500 @@ -63,7 +63,7 @@ */ public void start(BundleContext context) throws Exception { super.start(context); - IProxyData proxyData = ProxyUtils.getProxyData(new URI("http://www.yahoo.com")); + IProxyData proxyData = ProxyUtils.getProxyData(new URI("http://www.yahoo.com")); //$NON-NLS-1$ System.setProperty(PROPERTY_PROXYHOST, proxyData.getHost()); System.setProperty(PROPERTY_PROXYPORT, String.valueOf(proxyData.getPort())); } @@ -124,7 +124,7 @@ is.close(); } catch (IOException e) { String message = - MessageFormat.format("Could not find URL in configuration/server.properties file for key={0}", key); + MessageFormat.format(Messages.Activator_MissingConfigURLError, key); Activator.logError(message, e); } return (String) properties.get(key); diff -r a53047bc0aba -r cd8159f371c7 core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/Messages.java --- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/Messages.java Wed Jul 21 14:13:29 2010 -0500 +++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/Messages.java Wed Jul 21 14:53:42 2010 -0500 @@ -4,23 +4,32 @@ public class Messages extends NLS { private static final String BUNDLE_NAME = "com.nokia.carbide.discovery.ui.messages"; //$NON-NLS-1$ - public static String DiscoveryView_AdvancedInstallLabel; - public static String DiscoveryView_CheckAllLabel; - public static String DiscoveryView_GatherExtensionsTitle; - public static String DiscoveryView_GatheringInstallInfoTitle; - public static String DiscoveryView_InstallLabel; - public static String DiscoveryView_MissingDirectoryURLError; - public static String DiscoveryView_RefreshLabel; - public static String DiscoveryView_StatusLineFmt; - public static String DiscoveryView_UncheckAllLabel; + public static String AbstractBrowserPortalPage_BackLabel; + public static String AbstractBrowserPortalPage_BadURLError; + public static String AbstractBrowserPortalPage_ForwardLabel; + public static String AbstractBrowserPortalPage_NavigationTitle; + public static String AbstractBrowserPortalPage_RefreshLabel; + public static String AbstractBrowserPortalPage_StopLabel; + public static String Activator_MissingConfigURLError; public static String HomePage_Title; public static String InstallExtensionsPage_ActionBarTitle; + public static String InstallExtensionsPage_AdvancedInstallLabel; public static String InstallExtensionsPage_BuzillaActionName; + public static String InstallExtensionsPage_CheckAllLabel; + public static String InstallExtensionsPage_GatherExtensionsTitle; + public static String InstallExtensionsPage_GatheringInstallInfoTitle; + public static String InstallExtensionsPage_InstallLabel; + public static String InstallExtensionsPage_InstallTip; public static String InstallExtensionsPage_LinkBarTitle; + public static String InstallExtensionsPage_MissingDirectoryURLError; + public static String InstallExtensionsPage_RefreshLabel; + public static String InstallExtensionsPage_StatusLineFmt; public static String InstallExtensionsPage_Title; + public static String InstallExtensionsPage_UncheckAllLabel; public static String PortalEditor_Name; public static String PortalEditor_PageLoadError; public static String PortalEditor_PageOpenError; + public static String PortalEditor_PageRankError; public static String SupportPage_Title; static { // initialize resource bundle diff -r a53047bc0aba -r cd8159f371c7 core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/messages.properties --- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/messages.properties Wed Jul 21 14:13:29 2010 -0500 +++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/messages.properties Wed Jul 21 14:53:42 2010 -0500 @@ -1,17 +1,26 @@ -DiscoveryView_AdvancedInstallLabel=Advanced Install... -DiscoveryView_CheckAllLabel=Check All Items -DiscoveryView_GatherExtensionsTitle=Gathering Extensions -DiscoveryView_GatheringInstallInfoTitle=Gathering Install Information -DiscoveryView_InstallLabel=Install Checked Items... -DiscoveryView_RefreshLabel=Refresh -DiscoveryView_StatusLineFmt={0} item(s) checked -DiscoveryView_UncheckAllLabel=Uncheck All Items +AbstractBrowserPortalPage_BackLabel=Back +AbstractBrowserPortalPage_BadURLError=Could not load page due to bad URL +AbstractBrowserPortalPage_ForwardLabel=Forward +AbstractBrowserPortalPage_NavigationTitle=Navigation +AbstractBrowserPortalPage_RefreshLabel=Refresh Page +AbstractBrowserPortalPage_StopLabel=Stop Loading +Activator_MissingConfigURLError=Could not find URL in configuration/server.properties file for key={0} HomePage_Title=Home InstallExtensionsPage_ActionBarTitle=Install Actions +InstallExtensionsPage_AdvancedInstallLabel=Advanced Install... InstallExtensionsPage_BuzillaActionName=Carbide Bugzilla +InstallExtensionsPage_CheckAllLabel=Check All +InstallExtensionsPage_GatherExtensionsTitle=Gathering Extensions +InstallExtensionsPage_GatheringInstallInfoTitle=Gathering Install Information +InstallExtensionsPage_InstallLabel=Install... +InstallExtensionsPage_InstallTip=Install checked items InstallExtensionsPage_LinkBarTitle=Links +InstallExtensionsPage_RefreshLabel=Refresh +InstallExtensionsPage_StatusLineFmt={0} item(s) checked InstallExtensionsPage_Title=Install Extensions +InstallExtensionsPage_UncheckAllLabel=Check None PortalEditor_Name=Carbide Portal PortalEditor_PageLoadError=Could not load portal page PortalEditor_PageOpenError=Could not open portal +PortalEditor_PageRankError=Could not get rank for portal page {0} SupportPage_Title=Carbide Support diff -r a53047bc0aba -r cd8159f371c7 core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/PortalEditor.java --- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/PortalEditor.java Wed Jul 21 14:13:29 2010 -0500 +++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/PortalEditor.java Wed Jul 21 14:53:42 2010 -0500 @@ -92,7 +92,7 @@ rank = Integer.parseInt(rankString); } catch (NumberFormatException e) { - Activator.logError(MessageFormat.format("Could not get rank for portal page {0}", + Activator.logError(MessageFormat.format(Messages.PortalEditor_PageRankError, portalPage.getClass().getName()), e); } } diff -r a53047bc0aba -r cd8159f371c7 core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/TaskBar.java --- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/TaskBar.java Wed Jul 21 14:13:29 2010 -0500 +++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/TaskBar.java Wed Jul 21 14:53:42 2010 -0500 @@ -88,6 +88,16 @@ link.setToolTipText(toolTipText); link.setForeground(link.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE)); link.setBackground(link.getDisplay().getSystemColor(SWT.COLOR_WHITE)); + String actionId = action.getId(); + String[] highlightedActionIds = actionBar.getHighlightedActionIds(); + if (actionId != null && highlightedActionIds != null) { + for (String highlightedId : highlightedActionIds) { + if (highlightedId.equals(actionId)) { + link.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); + break; + } + } + } linkToActionMap.put(link, action); link.addHyperlinkListener(listener); } diff -r a53047bc0aba -r cd8159f371c7 core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractBrowserPortalPage.java --- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractBrowserPortalPage.java Wed Jul 21 14:13:29 2010 -0500 +++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractBrowserPortalPage.java Wed Jul 21 14:53:42 2010 -0500 @@ -36,6 +36,7 @@ import org.eclipse.ui.IEditorPart; import com.nokia.carbide.discovery.ui.Activator; +import com.nokia.carbide.discovery.ui.Messages; public abstract class AbstractBrowserPortalPage implements IPortalPage { @@ -74,7 +75,7 @@ @Override public String getTitle() { - return "Navigation"; + return Messages.AbstractBrowserPortalPage_NavigationTitle; } @Override @@ -84,7 +85,7 @@ private void makeActions() { actions = new ArrayList(); - IAction a = new Action("Back") { + IAction a = new Action(Messages.AbstractBrowserPortalPage_BackLabel) { @Override public void run() { if (browser != null) { @@ -99,7 +100,7 @@ }; actions.add(a); - a = new Action("Forward") { + a = new Action(Messages.AbstractBrowserPortalPage_ForwardLabel) { @Override public void run() { if (browser != null) { @@ -114,7 +115,7 @@ }; actions.add(a); - a = new Action("Refresh Page") { + a = new Action(Messages.AbstractBrowserPortalPage_RefreshLabel) { @Override public void run() { if (browser != null) { @@ -130,7 +131,7 @@ }; actions.add(a); - a = new Action("Stop Loading") { + a = new Action(Messages.AbstractBrowserPortalPage_StopLabel) { @Override public void run() { if (browser != null) { @@ -155,6 +156,11 @@ browser.setCursor(loading ? browser.getDisplay().getSystemCursor(SWT.CURSOR_WAIT) : null); this.loading = loading; } + + @Override + public String[] getHighlightedActionIds() { + return null; + } } private Browser browser; @@ -179,7 +185,7 @@ URL url = new URL(Activator.getFromServerProperties(getClass().getName())); return url.toString(); } catch (MalformedURLException e) { - Activator.logError("Could not load page due to bad URL", e); + Activator.logError(Messages.AbstractBrowserPortalPage_BadURLError, e); } return null; diff -r a53047bc0aba -r cd8159f371c7 core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/IPortalPage.java --- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/IPortalPage.java Wed Jul 21 14:13:29 2010 -0500 +++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/IPortalPage.java Wed Jul 21 14:53:42 2010 -0500 @@ -46,6 +46,12 @@ * @return IAction */ IAction[] getActions(); + + /** + * Action ids for actions that should be emphasized in the action bar (e.g., bold font) + * @return String[] or null + */ + String[] getHighlightedActionIds(); } diff -r a53047bc0aba -r cd8159f371c7 core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/view/DiscoveryView.java --- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/view/DiscoveryView.java Wed Jul 21 14:13:29 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,294 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -package com.nokia.carbide.internal.discovery.ui.view; - - -import java.net.URI; -import java.net.URISyntaxException; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.equinox.internal.p2.discovery.Catalog; -import org.eclipse.equinox.internal.p2.discovery.DiscoveryCore; -import org.eclipse.equinox.internal.p2.discovery.compatibility.BundleDiscoveryStrategy; -import org.eclipse.equinox.internal.p2.discovery.compatibility.RemoteBundleDiscoveryStrategy; -import org.eclipse.equinox.internal.p2.discovery.model.CatalogItem; -import org.eclipse.equinox.internal.p2.ui.discovery.DiscoveryUi; -import org.eclipse.equinox.internal.p2.ui.discovery.wizards.CatalogConfiguration; -import org.eclipse.equinox.internal.p2.ui.discovery.wizards.CatalogViewer; -import org.eclipse.equinox.p2.core.IProvisioningAgent; -import org.eclipse.equinox.p2.operations.ProvisioningSession; -import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; -import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; -import org.eclipse.equinox.p2.ui.ProvisioningUI; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.layout.GridDataFactory; -import org.eclipse.jface.layout.GridLayoutFactory; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.actions.BaseSelectionListenerAction; -import org.eclipse.ui.part.ViewPart; - -import com.nokia.carbide.discovery.ui.Activator; -import com.nokia.carbide.discovery.ui.Messages; -import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils; - -@SuppressWarnings("restriction") -public class DiscoveryView extends ViewPart { - - private final class RunnableContextDialog extends ProgressMonitorDialog { - private final String title; - - private RunnableContextDialog(Shell parent, String title) { - super(parent); - this.title = title; - } - - @Override - protected void configureShell(Shell shell) { - super.configureShell(shell); - shell.setText(title); - } - - } - - private static final String DIRECTORY_KEY = "com.nokia.carbide.discovery.directory"; //$NON-NLS-1$ - - private CatalogViewer viewer; - private Action refreshAction; - private BaseSelectionListenerAction checkAllAction; - private BaseSelectionListenerAction checkNoneAction; - private BaseSelectionListenerAction installAction; - private Action showInstallWizardAction; - private ISelectionChangedListener selectionListener; - - /** - * This is a callback that will allow us - * to create the viewer and initialize it. - */ - public void createPartControl(Composite parent) { - Composite c = new Composite(parent, SWT.NONE); - GridLayoutFactory.fillDefaults().applyTo(c); - viewer = new CatalogViewer(getCatalog(), getSite(), - new RunnableContextDialog(DiscoveryView.this.getViewSite().getShell(), - Messages.DiscoveryView_GatherExtensionsTitle), - getConfiguration()); - viewer.createControl(c); - GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getControl()); - - // Create the help context id for the viewer's control - PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), - "com.nokia.carbide.discovery.ui.view.DiscoveryView.catalogviewer"); //$NON-NLS-1$ - makeActions(); - contributeToActionBars(); - if (!WorkbenchUtils.isJUnitRunning()) { // do not initialize the catalog if JUnit is running - getSite().getShell().getDisplay().asyncExec(new Runnable() { - @Override - public void run() { - viewer.updateCatalog(); - } - }); - } - } - - private CatalogConfiguration getConfiguration() { - CatalogConfiguration configuration = new CatalogConfiguration(); - configuration.setShowTagFilter(false); - return configuration; - } - - private Catalog getCatalog() { - Catalog catalog = new Catalog(); - catalog.setEnvironment(DiscoveryCore.createEnvironment()); - catalog.setVerifyUpdateSiteAvailability(false); - - // look for remote descriptor - RemoteBundleDiscoveryStrategy remoteDiscoveryStrategy = new RemoteBundleDiscoveryStrategy(); - String url = Activator.getFromServerProperties(DIRECTORY_KEY); - if (url != null) { - remoteDiscoveryStrategy.setDirectoryUrl(url); - catalog.getDiscoveryStrategies().add(remoteDiscoveryStrategy); - } - else // look for descriptors from installed bundles - catalog.getDiscoveryStrategies().add(new BundleDiscoveryStrategy()); - - return catalog; - } - - private void contributeToActionBars() { - IActionBars bars = getViewSite().getActionBars(); - fillLocalPullDown(bars.getMenuManager()); - fillLocalToolBar(bars.getToolBarManager()); - } - - private void fillLocalPullDown(IMenuManager manager) { - manager.add(checkAllAction); - manager.add(checkNoneAction); - manager.add(new Separator()); - manager.add(installAction); - manager.add(showInstallWizardAction); - } - - private void fillLocalToolBar(IToolBarManager manager) { - manager.add(refreshAction); - manager.add(installAction); - } - - private void makeActions() { - refreshAction = new Action() { - public void run() { - viewer.setSelection(StructuredSelection.EMPTY); - viewer.updateCatalog(); - viewer.refresh(); - } - }; - refreshAction.setText(Messages.DiscoveryView_RefreshLabel); - refreshAction.setImageDescriptor(Activator.getImageDescriptor("icons/refresh.gif")); //$NON-NLS-1$ - checkAllAction = new BaseSelectionListenerAction(Messages.DiscoveryView_CheckAllLabel) { - public void run() { - viewer.setSelection(StructuredSelection.EMPTY); - viewer.setSelection(getAllItemsSelection()); - viewer.refresh(); - } - - private IStructuredSelection getAllItemsSelection() { - List catalogItems = new ArrayList(); - for (CatalogItem catalogItem : viewer.getCatalog().getItems()) { - if (!catalogItem.isInstalled()) - catalogItems.add(catalogItem); - } - return new StructuredSelection(catalogItems); - } - - protected boolean updateSelection(IStructuredSelection selection) { - return !getAllItemsSelection().equals(selection); - }; - }; - checkNoneAction = new BaseSelectionListenerAction(Messages.DiscoveryView_UncheckAllLabel) { - public void run() { - viewer.setSelection(StructuredSelection.EMPTY); - viewer.refresh(); - }; - - protected boolean updateSelection(IStructuredSelection selection) { - return !selection.isEmpty(); - }; - }; - installAction = new BaseSelectionListenerAction(Messages.DiscoveryView_InstallLabel) { - public void run() { - DiscoveryUi.install(viewer.getCheckedItems(), - new RunnableContextDialog(DiscoveryView.this.getViewSite().getShell(), - Messages.DiscoveryView_GatheringInstallInfoTitle)); - }; - - protected boolean updateSelection(IStructuredSelection selection) { - return !selection.isEmpty(); - }; - }; - installAction.setImageDescriptor(Activator.getImageDescriptor("icons/icon-discovery.png")); //$NON-NLS-1$ - showInstallWizardAction = new Action(Messages.DiscoveryView_AdvancedInstallLabel) { - public void run() { - showInstallWizard(); - } - }; - viewer.addSelectionChangedListener(checkAllAction); - viewer.addSelectionChangedListener(checkNoneAction); - viewer.addSelectionChangedListener(installAction); - selectionListener = new ISelectionChangedListener() { - @Override - public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection selection = (IStructuredSelection) event.getSelection(); - IActionBars bars = getViewSite().getActionBars(); - bars.getStatusLineManager().setMessage( - selection.isEmpty() ? null : MessageFormat.format( - Messages.DiscoveryView_StatusLineFmt, selection.size())); - } - }; - viewer.addSelectionChangedListener(selectionListener); - } - - @Override - public void dispose() { - viewer.removeSelectionChangedListener(checkAllAction); - viewer.removeSelectionChangedListener(checkNoneAction); - viewer.removeSelectionChangedListener(installAction); - viewer.removeSelectionChangedListener(selectionListener); - - super.dispose(); - } - - /** - * Passing the focus request to the viewer's control. - */ - public void setFocus() { - } - - private void showInstallWizard() { - ProvisioningUI defaultUI = ProvisioningUI.getDefaultUI(); - ProvisioningSession session = defaultUI.getSession(); - IProvisioningAgent agent = session.getProvisioningAgent(); - IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME); - IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); - for (URI uri : getCatalogURIs()) { - metadataManager.addRepository(uri); - artifactManager.addRepository(uri); - } - defaultUI.openInstallWizard(null, null, null); - -// String profileId = defaultUI.getProfileId(); -// IProfileRegistry profileRegistry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); -// IProfile profile = profileRegistry.getProfile(profileId); -// IQueryResult queryResult = profile.query(QueryUtil.createIUGroupQuery(), null); -// List list = new ArrayList(); -// for (Iterator iter = queryResult.iterator(); iter.hasNext();) { -// IInstallableUnit iu = iter.next(); -// list.add(iu.getId() + "|" + iu.getVersion()); -// } -// Collections.sort(list); -// for (String s : list) { -// System.out.println(s); -// } - } - - private Collection getCatalogURIs() { - Set uris = new HashSet(); - for (CatalogItem catalogItem : viewer.getCatalog().getItems()) { - try { - uris.add(new URI(catalogItem.getSiteUrl())); - } catch (URISyntaxException e) { - // ignore bad URIs - } - } - return uris; - }; - -} \ No newline at end of file diff -r a53047bc0aba -r cd8159f371c7 core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/view/InstallExtensionsPage.java --- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/view/InstallExtensionsPage.java Wed Jul 21 14:13:29 2010 -0500 +++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/view/InstallExtensionsPage.java Wed Jul 21 14:53:42 2010 -0500 @@ -54,6 +54,8 @@ @SuppressWarnings("restriction") public class InstallExtensionsPage implements IPortalPage { + private static final String INSTALL_ACTION_ID = InstallExtensionsPage.class.getName() + ".install"; //$NON-NLS-1$ + private final class RunnableContextDialog extends ProgressMonitorDialog { private final String title; @@ -86,6 +88,11 @@ public IAction[] getActions() { return actions; } + + @Override + public String[] getHighlightedActionIds() { + return new String[] {INSTALL_ACTION_ID}; + } } private final class LinkBar implements IActionBar { @@ -110,6 +117,11 @@ }; return new IAction[] { action }; } + + @Override + public String[] getHighlightedActionIds() { + return null; + } } private static final String DIRECTORY_KEY = "com.nokia.carbide.discovery.directory"; //$NON-NLS-1$ @@ -137,7 +149,7 @@ GridLayoutFactory.swtDefaults().applyTo(c); viewer = new CatalogViewer(getCatalog(), part.getEditorSite(), new RunnableContextDialog(part.getEditorSite().getShell(), - Messages.DiscoveryView_GatherExtensionsTitle), + Messages.InstallExtensionsPage_GatherExtensionsTitle), getConfiguration()); viewer.createControl(c); GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getControl()); @@ -196,7 +208,28 @@ private IAction[] makeActions(final IEditorPart part) { selectionListeners = new ArrayList(); List actions = new ArrayList(); - IAction action = new Action(Messages.DiscoveryView_RefreshLabel) { + IAction action; + + // install + action = new BaseSelectionListenerAction(Messages.InstallExtensionsPage_InstallLabel) { + public void run() { + DiscoveryUi.install(viewer.getCheckedItems(), + new RunnableContextDialog(part.getEditorSite().getShell(), + Messages.InstallExtensionsPage_GatheringInstallInfoTitle)); + }; + + protected boolean updateSelection(IStructuredSelection selection) { + scheduleUpdateAllActionUIs(); + return !selection.isEmpty(); + }; + }; + action.setToolTipText(Messages.InstallExtensionsPage_InstallTip); + action.setId(INSTALL_ACTION_ID); + selectionListeners.add((ISelectionChangedListener) action); + actions.add(action); + + // refresh + action = new Action(Messages.InstallExtensionsPage_RefreshLabel) { public void run() { viewer.setSelection(StructuredSelection.EMPTY); viewer.updateCatalog(); @@ -205,7 +238,8 @@ }; actions.add(action); - action = new BaseSelectionListenerAction(Messages.DiscoveryView_CheckAllLabel) { + // check all + action = new BaseSelectionListenerAction(Messages.InstallExtensionsPage_CheckAllLabel) { public void run() { viewer.setSelection(StructuredSelection.EMPTY); viewer.setSelection(getAllItemsSelection()); @@ -226,11 +260,12 @@ return !getAllItemsSelection().equals(selection); } }; - action.setId(getClass().getName() + ".checkAll"); //$NON-NLS-1$ + action.setId(InstallExtensionsPage.class.getName() + ".checkAll"); //$NON-NLS-1$ selectionListeners.add((ISelectionChangedListener) action); actions.add(action); - action = new BaseSelectionListenerAction(Messages.DiscoveryView_UncheckAllLabel) { + // uncheck all + action = new BaseSelectionListenerAction(Messages.InstallExtensionsPage_UncheckAllLabel) { public void run() { viewer.setSelection(StructuredSelection.EMPTY); viewer.refresh(); @@ -241,27 +276,12 @@ return !selection.isEmpty(); }; }; - action.setId(getClass().getName() + ".uncheckAll"); //$NON-NLS-1$ + action.setId(InstallExtensionsPage.class.getName() + ".uncheckAll"); //$NON-NLS-1$ selectionListeners.add((ISelectionChangedListener) action); actions.add(action); - - action = new BaseSelectionListenerAction(Messages.DiscoveryView_InstallLabel) { - public void run() { - DiscoveryUi.install(viewer.getCheckedItems(), - new RunnableContextDialog(part.getEditorSite().getShell(), - Messages.DiscoveryView_GatheringInstallInfoTitle)); - }; - - protected boolean updateSelection(IStructuredSelection selection) { - scheduleUpdateAllActionUIs(); - return !selection.isEmpty(); - }; - }; - action.setId(getClass().getName() + ".install"); //$NON-NLS-1$ - selectionListeners.add((ISelectionChangedListener) action); - actions.add(action); - - action = new Action(Messages.DiscoveryView_AdvancedInstallLabel) { + + // advanced install + action = new Action(Messages.InstallExtensionsPage_AdvancedInstallLabel) { public void run() { showInstallWizard(); } @@ -275,7 +295,7 @@ IActionBars bars = part.getEditorSite().getActionBars(); bars.getStatusLineManager().setMessage( selection.isEmpty() ? null : MessageFormat.format( - Messages.DiscoveryView_StatusLineFmt, selection.size())); + Messages.InstallExtensionsPage_StatusLineFmt, selection.size())); } }; selectionListeners.add(selectionListener);