--- a/core/com.nokia.carbide.discovery.ui/META-INF/MANIFEST.MF Wed May 19 14:34:54 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/META-INF/MANIFEST.MF Wed May 19 15:35:14 2010 -0500
@@ -4,6 +4,7 @@
Bundle-SymbolicName: com.nokia.carbide.discovery.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.nokia.carbide.discovery.ui.Activator
+Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.equinox.p2.discovery;bundle-version="1.0.0",
--- a/core/com.nokia.carbide.discovery.ui/build.properties Wed May 19 14:34:54 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/build.properties Wed May 19 15:35:14 2010 -0500
@@ -4,4 +4,6 @@
META-INF/,\
.,\
icons/,\
- contexts.xml
+ contexts.xml,\
+ OSGI-INF/l10n/bundle.properties,\
+ plugin.properties
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.discovery.ui/plugin.properties Wed May 19 15:35:14 2010 -0500
@@ -0,0 +1,1 @@
+view.name=Install Extensions
--- a/core/com.nokia.carbide.discovery.ui/plugin.xml Wed May 19 14:34:54 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/plugin.xml Wed May 19 15:35:14 2010 -0500
@@ -4,14 +4,10 @@
<extension
point="org.eclipse.ui.views">
- <category
- id="com.nokia.carbide.discovery.category"
- name="Discovery">
- </category>
<view
- name="Install View"
+ name="%view.name"
icon="icons/icon-discovery.png"
- category="com.nokia.carbide.discovery.category"
+ category="com.nokia.carbide.cpp"
class="com.nokia.carbide.discovery.ui.view.DiscoveryView"
id="com.nokia.carbide.discovery.view">
</view>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/Messages.java Wed May 19 15:35:14 2010 -0500
@@ -0,0 +1,20 @@
+package com.nokia.carbide.discovery.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "com.nokia.carbide.discovery.ui.messages"; //$NON-NLS-1$
+ public static String DiscoveryView_CheckAllLabel;
+ 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;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/messages.properties Wed May 19 15:35:14 2010 -0500
@@ -0,0 +1,6 @@
+DiscoveryView_CheckAllLabel=Check All Items
+DiscoveryView_InstallLabel=Install Checked Items...
+DiscoveryView_MissingDirectoryURLError=Could not find URL in configuration/server.properties file for key={0}
+DiscoveryView_RefreshLabel=Refresh
+DiscoveryView_StatusLineFmt={0} item(s) checked
+DiscoveryView_UncheckAllLabel=Uncheck All Items
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/view/DiscoveryView.java Wed May 19 14:34:54 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/view/DiscoveryView.java Wed May 19 15:35:14 2010 -0500
@@ -27,7 +27,9 @@
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.osgi.service.datalocation.Location;
import org.eclipse.swt.SWT;
@@ -39,6 +41,7 @@
import org.eclipse.ui.part.ViewPart;
import com.nokia.carbide.discovery.ui.Activator;
+import com.nokia.carbide.discovery.ui.Messages;
@SuppressWarnings("restriction")
public class DiscoveryView extends ViewPart {
@@ -47,12 +50,14 @@
private CatalogViewer viewer;
private Action refreshAction;
- private BaseSelectionListenerAction selectAllAction;
- private BaseSelectionListenerAction selectNoneAction;
+ private BaseSelectionListenerAction checkAllAction;
+ private BaseSelectionListenerAction checkNoneAction;
private BaseSelectionListenerAction installAction;
private boolean initialized;
+ private ISelectionChangedListener selectionListener;
+
public DiscoveryView() {
}
@@ -68,7 +73,8 @@
GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getControl());
// Create the help context id for the viewer's control
- PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "TestDiscovery.viewer");
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(),
+ "com.nokia.carbide.discovery.ui.view.DiscoveryView.viewer"); //$NON-NLS-1$
makeActions();
contributeToActionBars();
}
@@ -110,7 +116,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.DiscoveryView_MissingDirectoryURLError, key);
Activator.logError(message, e);
}
return (String) properties.get(key);
@@ -123,8 +129,8 @@
}
private void fillLocalPullDown(IMenuManager manager) {
- manager.add(selectAllAction);
- manager.add(selectNoneAction);
+ manager.add(checkAllAction);
+ manager.add(checkNoneAction);
}
private void fillLocalToolBar(IToolBarManager manager) {
@@ -135,13 +141,16 @@
private void makeActions() {
refreshAction = new Action() {
public void run() {
+ viewer.setSelection(StructuredSelection.EMPTY);
+ viewer.refresh();
viewer.updateCatalog();
}
};
- refreshAction.setText("Refresh");
- refreshAction.setImageDescriptor(Activator.getImageDescriptor("icons/refresh.gif"));
- selectAllAction = new BaseSelectionListenerAction("Select All Items") {
+ 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();
}
@@ -155,7 +164,7 @@
return !getAllItemsSelection().equals(selection);
};
};
- selectNoneAction = new BaseSelectionListenerAction("Deselect All Items") {
+ checkNoneAction = new BaseSelectionListenerAction(Messages.DiscoveryView_UncheckAllLabel) {
public void run() {
viewer.setSelection(StructuredSelection.EMPTY);
viewer.refresh();
@@ -165,7 +174,7 @@
return !selection.isEmpty();
};
};
- installAction = new BaseSelectionListenerAction("Install Checked Items...") {
+ installAction = new BaseSelectionListenerAction(Messages.DiscoveryView_InstallLabel) {
public void run() {
DiscoveryUi.install(viewer.getCheckedItems(), new ProgressMonitorDialog(DiscoveryView.this.getViewSite().getShell()));
};
@@ -174,17 +183,29 @@
return !selection.isEmpty();
};
};
- installAction.setImageDescriptor(Activator.getImageDescriptor("icons/icon-discovery.png"));
- viewer.addSelectionChangedListener(selectAllAction);
- viewer.addSelectionChangedListener(selectNoneAction);
+ installAction.setImageDescriptor(Activator.getImageDescriptor("icons/icon-discovery.png")); //$NON-NLS-1$
+ 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(selectAllAction);
- viewer.removeSelectionChangedListener(selectNoneAction);
+ viewer.removeSelectionChangedListener(checkAllAction);
+ viewer.removeSelectionChangedListener(checkNoneAction);
viewer.removeSelectionChangedListener(installAction);
+ viewer.removeSelectionChangedListener(selectionListener);
super.dispose();
}
@@ -198,10 +219,12 @@
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- viewer.updateCatalog();
- viewer.setSelection(StructuredSelection.EMPTY);
+ if (viewer.getViewer().getContentProvider() != null) {
+ viewer.updateCatalog();
+ }
}
});
}
}
+
}
\ No newline at end of file