Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 131668 Details for
Bug 247920
[product] add validate button
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
org.eclipse.pde.ui.patch
clipboard.txt (text/plain), 15.33 KB, created by
Chris Aniszczyk
on 2009-04-13 11:58:04 EDT
(
hide
)
Description:
org.eclipse.pde.ui.patch
Filename:
MIME Type:
Creator:
Chris Aniszczyk
Created:
2009-04-13 11:58:04 EDT
Size:
15.33 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.ui >Index: src/org/eclipse/pde/internal/ui/pderesources.properties >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties,v >retrieving revision 1.1067 >diff -u -r1.1067 pderesources.properties >--- src/org/eclipse/pde/internal/ui/pderesources.properties 30 Mar 2009 20:47:19 -0000 1.1067 >+++ src/org/eclipse/pde/internal/ui/pderesources.properties 13 Apr 2009 15:58:17 -0000 >@@ -1879,6 +1879,7 @@ > Product_DependenciesPage_title=Dependencies > ProductFileWizadPage_groupTitle=Initialize the file content > Product_PluginSection_newFragment=New Fragment... >+Product_validateAction=Validate... > Product_overview_testing=<form>\ > <li style="text" value="1." bindent="5"><a href="action.synchronize">Synchronize</a> this configuration with the product''s defining plug-in.</li>\ > <li style="text" value="2." bindent="5">Test the product by launching a runtime instance of it:</li>{0}</form> >Index: src/org/eclipse/pde/internal/ui/PDEUIMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java,v >retrieving revision 1.427 >diff -u -r1.427 PDEUIMessages.java >--- src/org/eclipse/pde/internal/ui/PDEUIMessages.java 30 Mar 2009 20:47:19 -0000 1.427 >+++ src/org/eclipse/pde/internal/ui/PDEUIMessages.java 13 Apr 2009 15:58:17 -0000 >@@ -1832,6 +1832,7 @@ > public static String Product_DependenciesPage_title; > public static String ProductFileWizadPage_groupTitle; > public static String Product_PluginSection_newFragment; >+ public static String Product_validateAction; > public static String Product_overview_testing; > public static String ProductInfoSection_title; > public static String GeneralInfoSection_title; >Index: src/org/eclipse/pde/internal/ui/launcher/LaunchValidationOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/LaunchValidationOperation.java,v >retrieving revision 1.5 >diff -u -r1.5 LaunchValidationOperation.java >--- src/org/eclipse/pde/internal/ui/launcher/LaunchValidationOperation.java 16 Jan 2008 17:08:30 -0000 1.5 >+++ src/org/eclipse/pde/internal/ui/launcher/LaunchValidationOperation.java 13 Apr 2009 15:58:17 -0000 >@@ -71,7 +71,7 @@ > > } > >- private IExecutionEnvironment[] getMatchingEnvironments() throws CoreException { >+ protected IExecutionEnvironment[] getMatchingEnvironments() throws CoreException { > IVMInstall install = VMHelper.getVMInstall(fLaunchConfiguration); > if (install == null) > return new IExecutionEnvironment[0]; >Index: src/org/eclipse/pde/internal/ui/editor/product/PluginSection.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/PluginSection.java,v >retrieving revision 1.48 >diff -u -r1.48 PluginSection.java >--- src/org/eclipse/pde/internal/ui/editor/product/PluginSection.java 1 Apr 2009 22:15:00 -0000 1.48 >+++ src/org/eclipse/pde/internal/ui/editor/product/PluginSection.java 13 Apr 2009 15:58:17 -0000 >@@ -17,6 +17,7 @@ > import org.eclipse.core.runtime.*; > import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jface.action.*; >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.viewers.*; > import org.eclipse.jface.window.Window; > import org.eclipse.jface.wizard.WizardDialog; >@@ -31,6 +32,7 @@ > import org.eclipse.pde.internal.ui.editor.*; > import org.eclipse.pde.internal.ui.editor.plugin.ManifestEditor; > import org.eclipse.pde.internal.ui.elements.DefaultTableProvider; >+import org.eclipse.pde.internal.ui.launcher.*; > import org.eclipse.pde.internal.ui.parts.TablePart; > import org.eclipse.pde.internal.ui.search.dependencies.DependencyCalculator; > import org.eclipse.pde.internal.ui.util.PersistablePluginObject; >@@ -61,6 +63,7 @@ > private Button fIncludeOptionalButton; > private Action fNewPluginAction; > private Action fNewFragmentAction; >+ private Action fValidateAction; > public static final QualifiedName OPTIONAL_PROPERTY = new QualifiedName(IPDEUIConstants.PLUGIN_ID, "product.includeOptional"); //$NON-NLS-1$ > > class NewPluginAction extends Action { >@@ -78,7 +81,7 @@ > class NewFragmentAction extends Action { > > public NewFragmentAction() { >- super(PDEUIMessages.Product_PluginSection_newFragment, IAction.AS_PUSH_BUTTON); >+ super(PDEUIMessages.Product_validateAction, IAction.AS_PUSH_BUTTON); > setImageDescriptor(PDEPluginImages.DESC_NEWFRAGPRJ_TOOL); > } > >@@ -87,6 +90,19 @@ > } > } > >+ class ValidateAction extends Action { >+ >+ public ValidateAction() { >+ super(PDEUIMessages.Product_PluginSection_newFragment, IAction.AS_PUSH_BUTTON); >+ setImageDescriptor(PDEPluginImages.DESC_VALIDATE_TOOL); >+ } >+ >+ public void run() { >+ handleValidate(); >+ } >+ >+ } >+ > public PluginSection(PDEFormPage formPage, Composite parent) { > super(formPage, parent, Section.DESCRIPTION, getButtonLabels()); > } >@@ -165,8 +181,10 @@ > }); > fNewPluginAction = new NewPluginAction(); > fNewFragmentAction = new NewFragmentAction(); >+ fValidateAction = new ValidateAction(); > toolBarManager.add(fNewPluginAction); > toolBarManager.add(fNewFragmentAction); >+ toolBarManager.add(fValidateAction); > > toolBarManager.update(true); > section.setTextClient(toolbar); >@@ -607,6 +625,7 @@ > if (updateRemoveAll) > tablePart.setButtonEnabled(4, isEditable() && count > 0); > tablePart.setButtonEnabled(2, isEditable() && count > 0); >+ tablePart.setButtonEnabled(5, isEditable() && count == 1); > } > > protected boolean createCount() { >@@ -616,4 +635,28 @@ > public boolean includeOptionalDependencies() { > return fIncludeOptionalButton.getSelection(); > } >+ >+ private void handleValidate() { >+ try { >+ HashMap map = new HashMap(); >+ IProductPlugin[] plugins = getProduct().getPlugins(); >+ for (int i = 0; i < plugins.length; i++) { >+ String id = plugins[i].getId(); >+ if (id == null || map.containsKey(id)) >+ continue; >+ IPluginModelBase model = PluginRegistry.findModel(id); >+ if (model != null && TargetPlatformHelper.matchesCurrentEnvironment(model)) >+ map.put(id, model); >+ } >+ IPluginModelBase[] models = (IPluginModelBase[]) map.values().toArray(new IPluginModelBase[map.size()]); >+ LaunchValidationOperation operation = new ProductValidationOperation(models); >+ LaunchPluginValidator.runValidationOperation(operation, new NullProgressMonitor()); >+ if (!operation.hasErrors()) { >+ MessageDialog.openInformation(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.PluginStatusDialog_pluginValidation, PDEUIMessages.AbstractLauncherToolbar_noProblems); >+ } >+ } catch (CoreException e) { >+ PDEPlugin.logException(e); >+ } >+ >+ } > } >Index: src/org/eclipse/pde/internal/ui/editor/product/FeatureSection.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/product/FeatureSection.java,v >retrieving revision 1.37 >diff -u -r1.37 FeatureSection.java >--- src/org/eclipse/pde/internal/ui/editor/product/FeatureSection.java 1 Apr 2009 22:15:00 -0000 1.37 >+++ src/org/eclipse/pde/internal/ui/editor/product/FeatureSection.java 13 Apr 2009 15:58:17 -0000 >@@ -10,18 +10,22 @@ > *******************************************************************************/ > package org.eclipse.pde.internal.ui.editor.product; > >-import java.util.ArrayList; >+import java.util.*; >+import java.util.List; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.NullProgressMonitor; > import org.eclipse.jface.action.*; >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.util.IPropertyChangeListener; > import org.eclipse.jface.util.PropertyChangeEvent; > import org.eclipse.jface.viewers.*; > import org.eclipse.jface.window.Window; > import org.eclipse.jface.wizard.WizardDialog; > import org.eclipse.pde.core.IModelChangedEvent; >-import org.eclipse.pde.internal.core.FeatureModelManager; >-import org.eclipse.pde.internal.core.PDECore; >-import org.eclipse.pde.internal.core.ifeature.IFeature; >-import org.eclipse.pde.internal.core.ifeature.IFeatureModel; >+import org.eclipse.pde.core.plugin.IPluginModelBase; >+import org.eclipse.pde.core.plugin.PluginRegistry; >+import org.eclipse.pde.internal.core.*; >+import org.eclipse.pde.internal.core.ifeature.*; > import org.eclipse.pde.internal.core.iproduct.*; > import org.eclipse.pde.internal.ui.*; > import org.eclipse.pde.internal.ui.dialogs.FeatureSelectionDialog; >@@ -29,6 +33,7 @@ > import org.eclipse.pde.internal.ui.editor.actions.SortAction; > import org.eclipse.pde.internal.ui.editor.feature.FeatureEditor; > import org.eclipse.pde.internal.ui.elements.DefaultTableProvider; >+import org.eclipse.pde.internal.ui.launcher.*; > import org.eclipse.pde.internal.ui.parts.TablePart; > import org.eclipse.pde.internal.ui.util.SWTUtil; > import org.eclipse.pde.internal.ui.wizards.feature.NewFeatureProjectWizard; >@@ -46,6 +51,7 @@ > > private SortAction fSortAction; > private Action fNewFeatureAction; >+ private Action fValidateAction; > > class ContentProvider extends DefaultTableProvider { > public Object[] getElements(Object parent) { >@@ -65,6 +71,19 @@ > } > } > >+ class ValidateAction extends Action { >+ >+ public ValidateAction() { >+ super(PDEUIMessages.Product_validateAction, IAction.AS_PUSH_BUTTON); >+ setImageDescriptor(PDEPluginImages.DESC_VALIDATE_TOOL); >+ } >+ >+ public void run() { >+ handleValidate(); >+ } >+ >+ } >+ > private TableViewer fFeatureTable; > > public FeatureSection(PDEFormPage formPage, Composite parent) { >@@ -128,8 +147,8 @@ > * @param toolkit > */ > private void createSectionToolbar(Section section, FormToolkit toolkit) { >- ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT); >- ToolBar toolbar = toolBarManager.createControl(section); >+ ToolBarManager manager = new ToolBarManager(SWT.FLAT); >+ ToolBar toolbar = manager.createControl(section); > final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND); > toolbar.setCursor(handCursor); > // Cursor needs to be explicitly disposed >@@ -141,11 +160,13 @@ > } > }); > fNewFeatureAction = new NewFeatureAction(); >- toolBarManager.add(fNewFeatureAction); >+ manager.add(fNewFeatureAction); >+ fValidateAction = new ValidateAction(); >+ manager.add(fValidateAction); > fSortAction = new SortAction(fFeatureTable, PDEUIMessages.Product_FeatureSection_sortAlpha, null, null, this); >- toolBarManager.add(fSortAction); >+ manager.add(fSortAction); > >- toolBarManager.update(true); >+ manager.update(true); > section.setTextClient(toolbar); > } > >@@ -493,4 +514,62 @@ > updateButtons(true, true); > } > } >+ >+ // TODO this code needs to be cleaned up >+ // similar code in LaunchAction >+ private void handleValidate() { >+ try { >+ HashMap map = new HashMap(); >+ IFeatureModel[] features = getUniqueFeatures(); >+ for (int i = 0; i < features.length; i++) { >+ addFeaturePlugins(features[i].getFeature(), map); >+ } >+ IPluginModelBase[] models = (IPluginModelBase[]) map.values().toArray(new IPluginModelBase[map.size()]); >+ LaunchValidationOperation operation = new ProductValidationOperation(models); >+ LaunchPluginValidator.runValidationOperation(operation, new NullProgressMonitor()); >+ if (!operation.hasErrors()) { >+ MessageDialog.openInformation(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.PluginStatusDialog_pluginValidation, PDEUIMessages.AbstractLauncherToolbar_noProblems); >+ } >+ } catch (CoreException e) { >+ PDEPlugin.logException(e); >+ } >+ } >+ >+ private void addFeaturePlugins(IFeature feature, HashMap map) { >+ IFeaturePlugin[] plugins = feature.getPlugins(); >+ for (int i = 0; i < plugins.length; i++) { >+ String id = plugins[i].getId(); >+ if (id == null || map.containsKey(id)) >+ continue; >+ IPluginModelBase model = PluginRegistry.findModel(id); >+ if (model != null && TargetPlatformHelper.matchesCurrentEnvironment(model)) >+ map.put(id, model); >+ } >+ } >+ >+ private IFeatureModel[] getUniqueFeatures() { >+ ArrayList list = new ArrayList(); >+ IProductFeature[] features = getProduct().getFeatures(); >+ for (int i = 0; i < features.length; i++) { >+ String id = features[i].getId(); >+ String version = features[i].getVersion(); >+ addFeatureAndChildren(id, version, list); >+ } >+ return (IFeatureModel[]) list.toArray(new IFeatureModel[list.size()]); >+ } >+ >+ private void addFeatureAndChildren(String id, String version, List list) { >+ FeatureModelManager manager = PDECore.getDefault().getFeatureModelManager(); >+ IFeatureModel model = manager.findFeatureModel(id, version); >+ if (model == null || list.contains(model)) >+ return; >+ >+ list.add(model); >+ >+ IFeatureChild[] children = model.getFeature().getIncludedFeatures(); >+ for (int i = 0; i < children.length; i++) { >+ addFeatureAndChildren(children[i].getId(), children[i].getVersion(), list); >+ } >+ } >+ > } >Index: src/org/eclipse/pde/internal/ui/launcher/ProductValidationOperation.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ui/launcher/ProductValidationOperation.java >diff -N src/org/eclipse/pde/internal/ui/launcher/ProductValidationOperation.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ui/launcher/ProductValidationOperation.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,54 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 EclipseSource Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * EclipseSource Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.internal.ui.launcher; >+ >+import java.util.ArrayList; >+import java.util.List; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.jdt.launching.IVMInstall; >+import org.eclipse.jdt.launching.JavaRuntime; >+import org.eclipse.jdt.launching.environments.IExecutionEnvironment; >+import org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager; >+import org.eclipse.pde.core.plugin.IPluginModelBase; >+ >+public class ProductValidationOperation extends LaunchValidationOperation { >+ >+ private IPluginModelBase[] fModels; >+ >+ public ProductValidationOperation(IPluginModelBase[] models) { >+ super(null); >+ fModels = models; >+ } >+ >+ protected IPluginModelBase[] getModels() throws CoreException { >+ return fModels; >+ } >+ >+ protected IExecutionEnvironment[] getMatchingEnvironments() throws CoreException { >+ IVMInstall install = JavaRuntime.getDefaultVMInstall(); >+ >+ IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager(); >+ IExecutionEnvironment[] envs = manager.getExecutionEnvironments(); >+ List result = new ArrayList(envs.length); >+ for (int i = 0; i < envs.length; i++) { >+ IExecutionEnvironment env = envs[i]; >+ IVMInstall[] compatible = env.getCompatibleVMs(); >+ for (int j = 0; j < compatible.length; j++) { >+ if (compatible[j].equals(install)) { >+ result.add(env); >+ break; >+ } >+ } >+ } >+ return (IExecutionEnvironment[]) result.toArray(new IExecutionEnvironment[result.size()]); >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 247920
: 131668 |
131669