1 11 package org.eclipse.update.internal.ui.views; 12 13 import org.eclipse.core.runtime.*; 14 import org.eclipse.jface.action.Action; 15 import org.eclipse.jface.dialogs.*; 16 import org.eclipse.jface.wizard.WizardDialog; 17 import org.eclipse.swt.widgets.*; 18 import org.eclipse.update.core.IFeature; 19 import org.eclipse.update.internal.ui.wizards.ReplaceFeatureVersionWizard; 20 import org.eclipse.update.operations.*; 21 22 public class ReplaceVersionAction extends Action { 23 24 private IFeature currentFeature; 25 private IFeature[] features; 26 private Shell shell; 27 28 public ReplaceVersionAction(Shell shell, String text) { 29 super(text); 30 this.shell = shell; 31 } 32 33 public void setCurrentFeature(IFeature feature) { 34 currentFeature = feature; 35 } 36 37 public void setFeatures(IFeature[] features) { 38 this.features = features; 39 } 40 41 public void run() { 42 if (currentFeature == null || features == null || features.length < 2) 43 return; 44 45 IStatus status = OperationsManager.getValidator().validatePlatformConfigValid(); 46 if (status != null) { 47 ErrorDialog.openError(shell, null, null, status); 48 return; 49 } 50 51 ReplaceFeatureVersionWizard wizard = new ReplaceFeatureVersionWizard(currentFeature, features); 52 WizardDialog dialog = new WizardDialog(shell, wizard); 53 dialog.create(); 54 dialog.getShell().setText(shell.getText()); 55 dialog.getShell().setSize(400,400); 56 dialog.open(); 57 } 58 59 60 } 61 | Popular Tags |