1 11 package org.eclipse.pde.internal.ui.build; 12 13 import java.lang.reflect.InvocationTargetException ; 14 import org.eclipse.core.resources.IProject; 15 import org.eclipse.core.runtime.CoreException; 16 import org.eclipse.core.runtime.IProgressMonitor; 17 import org.eclipse.jface.dialogs.MessageDialog; 18 import org.eclipse.osgi.service.resolver.BundleDescription; 19 import org.eclipse.pde.core.plugin.IPluginModelBase; 20 import org.eclipse.pde.core.plugin.PluginRegistry; 21 import org.eclipse.pde.internal.build.AbstractScriptGenerator; 22 import org.eclipse.pde.internal.build.BuildScriptGenerator; 23 import org.eclipse.pde.internal.core.ClasspathHelper; 24 import org.eclipse.pde.internal.core.TargetPlatformHelper; 25 import org.eclipse.pde.internal.ui.PDEUIMessages; 26 27 public class BuildPluginAction extends BaseBuildAction { 28 29 protected void makeScripts(IProgressMonitor monitor) 30 throws InvocationTargetException , CoreException { 31 32 BuildScriptGenerator generator = new BuildScriptGenerator(); 33 AbstractScriptGenerator.setEmbeddedSource(AbstractScriptGenerator.getDefaultEmbeddedSource()); 34 AbstractScriptGenerator.setForceUpdateJar(AbstractScriptGenerator.getForceUpdateJarFormat()); 35 AbstractScriptGenerator.setConfigInfo(AbstractScriptGenerator.getDefaultConfigInfos()); 36 37 IProject project = fManifestFile.getProject(); 38 generator.setWorkingDirectory(project.getLocation().toOSString()); 39 String url = ClasspathHelper.getDevEntriesProperties(project.getLocation().addTrailingSeparator().toString() + "dev.properties", false); generator.setDevEntries(url); 41 generator.setPDEState(TargetPlatformHelper.getState()); 42 generator.setNextId(TargetPlatformHelper.getPDEState().getNextId()); 43 generator.setStateExtraData(TargetPlatformHelper.getBundleClasspaths(TargetPlatformHelper.getPDEState()), TargetPlatformHelper.getPatchMap(TargetPlatformHelper.getPDEState())); 44 generator.setBuildingOSGi(true); 45 IPluginModelBase model = PluginRegistry.findModel(project); 46 if(model != null && model.getPluginBase().getId() != null) { 47 generator.setBundles(new BundleDescription[] {model.getBundleDescription()}); 48 generator.generate(); 49 } 50 else 51 { MessageDialog.openError(null, 52 PDEUIMessages.BuildPluginAction_ErrorDialog_Title, 53 PDEUIMessages.BuildPluginAction_ErrorDialog_Message); 54 } 55 } 56 57 } 58 | Popular Tags |