--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/NewPluginChecker.java Tue Sep 14 15:23:21 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/NewPluginChecker.java Tue Sep 14 15:25:12 2010 -0500
@@ -22,8 +22,8 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
@@ -53,6 +53,8 @@
protected IStatus run(IProgressMonitor monitor) {
boolean installed = false;
boolean oneSDKWasScanned = false;
+ SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
+ int worked = 100 / sdkList.size();
for (ISymbianSDK sdk : sdkList) {
ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);
if (sbsv2BuildInfo != null) {
@@ -62,7 +64,7 @@
sbsv2BuildInfo.setPreviouslyScanned(true);
File featureDir = new File(sdk.getEPOCROOT() + SDK_FEATURE_SUBDIR);
try {
- IStatus status = DynamicP2Installer.install(featureDir, new NullProgressMonitor());
+ IStatus status = DynamicP2Installer.install(featureDir, subMonitor);
if (status.isOK()) {
// TODO advise user??
installed = true;
@@ -76,6 +78,8 @@
// Otherwise, these errors will be logged every time this check is done (workspace is opened)
// Originally, this was used to install MBS build support, but now is only used for SDK documentation
// ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Unable to install plug-ins dynamically.", e));
+ } finally {
+ subMonitor.worked(worked);
}
}
}
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPreferencePage.java Tue Sep 14 15:23:21 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPreferencePage.java Tue Sep 14 15:25:12 2010 -0500
@@ -24,6 +24,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.CellEditor;
@@ -236,6 +237,7 @@
private Button deleteButton;
private Button propertiesButton;
private Button rescanButton;
+ private Button scanPluginsButton;
private Label iconLabel;
private Label statusLabel;
@@ -289,6 +291,9 @@
* @see org.eclipse.jface.preference.PreferencePage#performOk()
*/
public boolean performOk() {
+ IPreferenceStore prefsStore = SDKUIPlugin.getDefault().getPreferenceStore();
+ prefsStore.setValue(SDKUIPreferenceConstants.SCAN_FOR_NEW_PLUGINS, scanPluginsButton.getSelection());
+
// Remember which SDK is enabled
for (ISymbianSDK sdk : sdkMgr.getSDKList()) {
((SymbianSDK)sdk).setEnabled(false);
@@ -312,6 +317,8 @@
*/
@Override
public Control createContents(Composite parent) {
+ IPreferenceStore prefsStore = SDKUIPlugin.getDefault().getPreferenceStore();
+
// Set up colors used in this preference page
Shell shell = parent.getShell();
black = shell.getDisplay().getSystemColor(SWT.COLOR_BLACK);
@@ -377,7 +384,16 @@
statusLabel.setLayoutData(gridData);
new Label(content, SWT.WRAP); // filler
-
+
+ // Scan for installable features in SDKs button
+ scanPluginsButton = new Button(content, SWT.CHECK);
+ scanPluginsButton.setToolTipText(Messages.getString("SDKPreferencePage.scanPlugins_ButtonToolTip")); //$NON-NLS-1$
+ scanPluginsButton.setText(Messages.getString("SDKPreferencePage.scanPlugins_Button_Label")); //$NON-NLS-1$
+ scanPluginsButton.setSelection(prefsStore.getBoolean(SDKUIPreferenceConstants.SCAN_FOR_NEW_PLUGINS));
+ addButtonListener(scanPluginsButton);
+
+ new Label(content, SWT.WRAP); // filler
+
// Rescan button
rescanButton = new Button(content, SWT.NONE);
rescanButton.setToolTipText(Messages.getString("SDKPreferencePage.Rescan_Button_ToolTip")); //$NON-NLS-1$
@@ -537,7 +553,9 @@
addSDKComponentTableItems();
sdkListTableViewer.refresh();
selectSDKEntry(0);
- NewPluginChecker.checkForNewlyInstalledPlugins(SDKUIPlugin.getDefault().getWorkbench());
+ if (scanPluginsButton.getSelection()) {
+ NewPluginChecker.checkForNewlyInstalledPlugins(SDKUIPlugin.getDefault().getWorkbench());
+ }
rescanButton.setText(Messages.getString("SDKPreferencePage.Rescan_Button_Label")); //$NON-NLS-1$
rescanButton.setEnabled(true);
}
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIPreferenceInitializer.java Tue Sep 14 15:23:21 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIPreferenceInitializer.java Tue Sep 14 15:25:12 2010 -0500
@@ -34,7 +34,7 @@
IPreferenceStore store = SDKUIPlugin.getDefault().getPreferenceStore();
store.setDefault(SDKUIPreferenceConstants.ENABLE_BSF_SCANNER, false);
store.setDefault(SDKUIPreferenceConstants.LISTEN_FOR_DEVICES_XML_CHANGE, true);
- store.setDefault(SDKUIPreferenceConstants.SCAN_FOR_NEW_PLUGINS, false);
+ store.setDefault(SDKUIPreferenceConstants.SCAN_FOR_NEW_PLUGINS, true);
store.setDefault(SDKUIPreferenceConstants.PLAT_EKA2_WINSCW, true);
store.setDefault(SDKUIPreferenceConstants.PLAT_EKA2_GCCE, true);
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties Tue Sep 14 15:23:21 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties Tue Sep 14 15:25:12 2010 -0500
@@ -14,6 +14,8 @@
SDKPreferencePage.Rescan_Button_Label=Rescan All SDKs
SDKPreferencePage.Rescan_Button_ToolTip=Rebuilds all SDK entries (same as restarting the IDE).
SDKPreferencePage.Rescanning_Button_Label=Rescanning...
+SDKPreferencePage.scanPlugins_Button_Label=Scan for installable features in SDKs
+SDKPreferencePage.scanPlugins_ButtonToolTip=Discover installable features found in SDKs and install them dynamically.
SDKPreferencePage.No_SDKs_Available_Message=No SDKs are available.
SDKPreferencePage.No_selected_SDK_detected=No selected SDK detected.
SDKPreferencePage.List_of_Available_SDKs_ToolTip=List of available SDKs.
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/SDKUIPlugin.java Tue Sep 14 15:23:21 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/SDKUIPlugin.java Tue Sep 14 15:25:12 2010 -0500
@@ -61,7 +61,10 @@
*/
public void start(BundleContext context) throws Exception {
super.start(context);
- NewPluginChecker.checkForNewlyInstalledPlugins(getWorkbench());
+ IPreferenceStore prefsStore = SDKUIPlugin.getDefault().getPreferenceStore();
+ if (prefsStore.getBoolean(SDKUIPreferenceConstants.SCAN_FOR_NEW_PLUGINS)) {
+ NewPluginChecker.checkForNewlyInstalledPlugins(getWorkbench());
+ }
ISDKManager sdkMgr = SDKCorePlugin.getSDKManager();
if (HostOS.IS_WIN32){
--- a/core/com.nokia.carbide.discovery.ui/plugin.xml Tue Sep 14 15:23:21 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/plugin.xml Tue Sep 14 15:25:12 2010 -0500
@@ -170,5 +170,12 @@
</description>
</wizard>
</extension>
+ <extension
+ point="org.eclipse.ui.elementFactories">
+ <factory
+ class="com.nokia.carbide.internal.discovery.ui.editor.PortalEditor"
+ id="com.nokia.carbide.discovery.ui.portalEditorFactory">
+ </factory>
+ </extension>
</plugin>
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/messages.properties Tue Sep 14 15:23:21 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/discovery/ui/messages.properties Tue Sep 14 15:25:12 2010 -0500
@@ -15,7 +15,7 @@
AbstractDiscoveryPortalPageLayer_CheckAllActionLabel=Select all
AbstractDiscoveryPortalPageLayer_CheckedItemsStatusMessage={0} item(s) selected
AbstractDiscoveryPortalPageLayer_GatheringExtensionsDesc=Gathering Extensions
-AbstractDiscoveryPortalPageLayer_GatheringInstallInfoDesc=Gathering Install Information
+AbstractDiscoveryPortalPageLayer_GatheringInstallInfoDesc=Gathering Install Information (may take several minutes)
AbstractDiscoveryPortalPageLayer_InstallActionLabel=Install...
AbstractDiscoveryPortalPageLayer_InstallActionTooltip=Install selected items
AbstractDiscoveryPortalPageLayer_P2InstallWizardOpenError=Could not open install wizard
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/PortalEditor.java Tue Sep 14 15:23:21 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/PortalEditor.java Tue Sep 14 15:25:12 2010 -0500
@@ -25,6 +25,7 @@
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
@@ -46,6 +47,8 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IElementFactory;
+import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
@@ -60,8 +63,50 @@
import com.nokia.cpp.internal.api.utils.core.Pair;
import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
-public class PortalEditor extends EditorPart implements IPortalEditor {
+public class PortalEditor extends EditorPart implements IPortalEditor, IElementFactory {
+ private static final class PortalEditorInput implements IEditorInput {
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ @Override
+ public String getToolTipText() {
+ return getName();
+ }
+
+ @Override
+ public IPersistableElement getPersistable() {
+ return new IPersistableElement() {
+ @Override
+ public void saveState(IMemento memento) {
+ }
+
+ @Override
+ public String getFactoryId() {
+ return "com.nokia.carbide.discovery.ui.portalEditorFactory"; //$NON-NLS-1$
+ }
+ };
+ }
+
+ @Override
+ public String getName() {
+ return Messages.PortalEditor_Name;
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ @Override
+ public boolean exists() {
+ return true;
+ }
+ }
+
class LayerExtension {
public LayerExtension(IPortalPageLayer layer, String title, int order) {
this.layer = layer;
@@ -257,47 +302,22 @@
}
public static void openPortal() {
- try {
- WorkbenchUtils.openEditor(getInput(), ID);
- } catch (PartInitException e) {
- Activator.logError(Messages.PortalEditor_PageOpenError, e);
- }
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ if (PlatformUI.isWorkbenchRunning())
+ WorkbenchUtils.openEditor(getInput(), ID);
+ } catch (PartInitException e) {
+ Activator.logError(Messages.PortalEditor_PageOpenError, e);
+ }
+ }
+ });
}
-
+
private static IEditorInput getInput() {
if (input == null) {
- input = new IEditorInput() {
- @SuppressWarnings("rawtypes")
- @Override
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- @Override
- public String getToolTipText() {
- return getName();
- }
-
- @Override
- public IPersistableElement getPersistable() {
- return null;
- }
-
- @Override
- public String getName() {
- return Messages.PortalEditor_Name;
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- @Override
- public boolean exists() {
- return false;
- }
- };
+ input = new PortalEditorInput();
}
return input;
@@ -341,4 +361,9 @@
return this;
}
+ @Override
+ public IAdaptable createElement(IMemento memento) {
+ return new PortalEditorInput();
+ }
+
}
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractBrowserPortalPageLayer.java Tue Sep 14 15:23:21 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractBrowserPortalPageLayer.java Tue Sep 14 15:25:12 2010 -0500
@@ -294,7 +294,7 @@
@Override
public String isValid(String newText) {
try {
- new URL(newText);
+ new URL(getLocationURL(newText));
} catch (MalformedURLException e) {
return Messages.AbstractBrowserPortalPageLayer_InvalidURLError;
}
@@ -303,9 +303,19 @@
});
int result = dlg.open();
if (result == Dialog.OK) {
- setUrl(dlg.getValue());
+ String value = dlg.getValue();
+ setUrl(getLocationURL(value));
actionBar.update();
}
+ }
+
+ private String getLocationURL(String value) {
+ try {
+ new URL(value);
+ } catch (MalformedURLException e) {
+ value = "http://" + value;
+ }
+ return value;
};
public boolean isEnabled() {
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/p2/DynamicP2Installer.java Tue Sep 14 15:23:21 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/p2/DynamicP2Installer.java Tue Sep 14 15:25:12 2010 -0500
@@ -24,6 +24,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.equinox.internal.provisional.p2.director.IDirector;
import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
@@ -118,6 +119,7 @@
}
private void doInstall(IProgressMonitor monitor) throws CoreException {
+ SubMonitor subMonitor = SubMonitor.convert(monitor, "Installing plugins from " + repositoryLocation.toOSString(), 100);
URI uri = URIUtil.toURI(repositoryLocation);
IMetadataRepositoryManager metadataRepoManager =
(IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
@@ -125,26 +127,34 @@
(IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
try {
// add and load repository
+ checkIfCanceled(subMonitor);
metadataRepoManager.addRepository(uri);
IMetadataRepository metadataRepository = metadataRepoManager.loadRepository(uri, null);
artifactRepoManager.addRepository(uri);
artifactRepoManager.loadRepository(uri, null);
+ subMonitor.worked(10);
// get IU from repository
- IQueryResult<IInstallableUnit> units = metadataRepository.query(QueryUtil.createIUGroupQuery(), monitor);
+ checkIfCanceled(subMonitor);
+ IQueryResult<IInstallableUnit> units = metadataRepository.query(QueryUtil.createIUGroupQuery(), subMonitor);
if (units.isEmpty())
throw new CoreException(Activator.makeErrorStatus("Could not find installable unit", null));
+ subMonitor.worked(10);
// check if installed
- IQueryResult<IInstallableUnit> result = profile.query(QueryUtil.createIUQuery(units.iterator().next()), monitor);
+ checkIfCanceled(subMonitor);
+ IQueryResult<IInstallableUnit> result = profile.query(QueryUtil.createIUQuery(units.iterator().next()), subMonitor);
if (!result.isEmpty())
throw new CoreException(Activator.makeStatus(IStatus.CANCEL, null, null)); // already installed
+ subMonitor.worked(10);
// do provisioning operation
+ checkIfCanceled(subMonitor);
ProfileChangeRequest request = new ProfileChangeRequest(profile);
request.addAll(units.toUnmodifiableSet());
IDirector director = (IDirector) agent.getService(IDirector.SERVICE_NAME);
- IStatus status = director.provision(request, null, monitor);
+ IStatus status = director.provision(request, null, subMonitor);
+ subMonitor.worked(70);
if (!status.isOK())
throw new CoreException(status);
@@ -152,6 +162,7 @@
finally {
metadataRepoManager.removeRepository(uri);
artifactRepoManager.removeRepository(uri);
+ subMonitor.done();
}
}
@@ -160,4 +171,10 @@
return profileRegistry.getProfile(provisioningUI.getProfileId());
}
+ private void checkIfCanceled(IProgressMonitor monitor) throws CoreException {
+ if (monitor.isCanceled()) {
+ throw new CoreException(Activator.makeStatus(IStatus.CANCEL, null, null)); // installation canceled
+ }
+ }
+
}
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/perspective/CarbideCppPerspectiveFactory.java Tue Sep 14 15:23:21 2010 -0500
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/perspective/CarbideCppPerspectiveFactory.java Tue Sep 14 15:25:12 2010 -0500
@@ -18,10 +18,16 @@
import org.eclipse.cdt.internal.ui.wizards.CWizardRegistry;
import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.ui.*;
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.navigator.resources.ProjectExplorer;
+import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin;
+
public class CarbideCppPerspectiveFactory implements IPerspectiveFactory {
private static final String SYMBIAN_PROJECT_NAVIGATOR_VIEW_ID =
@@ -83,6 +89,14 @@
layout.addShowInPart(ProjectExplorer.VIEW_ID);
addCDTWizardShortcutIdsToLayout(layout);
+
+ IHandlerService handlerService =
+ (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
+ try {
+ handlerService.executeCommand("com.nokia.carbide.discovery.commands.launch", null); //$NON-NLS-1$
+ } catch (Exception e) {
+ ProjectUIPlugin.log(e);
+ }
}
@SuppressWarnings("restriction")