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 141448 Details for
Bug 234139
[fiximprove][proguard]: Add proguard preverifier
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Add proguard preverifier
proguardRC5.patch (text/plain), 72.73 KB, created by
David Aragão
on 2009-07-13 14:39:51 EDT
(
hide
)
Description:
Add proguard preverifier
Filename:
MIME Type:
Creator:
David Aragão
Created:
2009-07-13 14:39:51 EDT
Size:
72.73 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mtj.core >Index: src/org/eclipse/mtj/internal/core/project/midp/MidletSuiteProject.java >=================================================================== >--- src/org/eclipse/mtj/internal/core/project/midp/MidletSuiteProject.java (revision 1342) >+++ src/org/eclipse/mtj/internal/core/project/midp/MidletSuiteProject.java (working copy) >@@ -35,6 +35,8 @@ > * Fernando Rocha(Motorola) - Correct the update of the project classpath. > * David Aragao (Motorola) - Problem when try to import a project without > * copy the files to the workspace. [Bug - 270157] >+ * Gustavo de Paula (Motorola) - Add proguard preverifier options >+ * David Aragão (Motorola) - Add proguard preverifier refactoring > */ > package org.eclipse.mtj.internal.core.project.midp; > >@@ -126,10 +128,8 @@ > */ > public static String getDefaultJadFileName(IProject project) { > String projectName = project.getName(); >- return NLS.bind(IMTJCoreConstants.VERSION_NLS_BIND_TEMPLATE, >- new String[] { projectName.replace(' ', '_'), >- APP_DESCRIPTOR_FILE_EXT }); //$NON-NLS-1$ >- >+ return NLS.bind("{0}.{1}", new String[] { >+ projectName.replace(' ', '_'), APP_DESCRIPTOR_FILE_EXT }); //$NON-NLS-1$ > } > > // The java project on which this MIDlet suite is based >@@ -167,7 +167,7 @@ > initializeMetadata(); > > MTJRuntime mtjRuntime = getRuntimeList().getActiveMTJRuntime(); >- if ((mtjRuntime != null) && (mtjRuntime.getDevice() == null)) { >+ if (mtjRuntime != null && mtjRuntime.getDevice() == null) { > try { > if (getProject().findMarkers( > IMTJCoreConstants.JAVAME_MISSING_DEVICE_MARKER, false, >@@ -208,9 +208,8 @@ > * org.eclipse.mtj.core.project.IMTJProject#createPackage(org.eclipse.core > * .runtime.IProgressMonitor, boolean, boolean) > */ >- public void createPackage(boolean obfuscate, >- boolean packageInactiveConfigs, IProgressMonitor monitor) >- throws CoreException { >+ public void createPackage(IProgressMonitor monitor, boolean obfuscate, >+ boolean packageInactiveConfigs) throws CoreException { > > Map<String, String> args = new HashMap<String, String>(); > args.put(PackageBuilder.ARG_DO_PACKAGE, Boolean.TRUE.toString()); >@@ -226,7 +225,7 @@ > BuildSpecManipulator manipulator = new BuildSpecManipulator(this > .getProject()); > // Set builder arguments >- manipulator.setBuilderArguments(IMTJCoreConstants.PACKAGE_BUILDER_ID, >+ manipulator.setBuilderArguments(org.eclipse.mtj.internal.core.IMTJCoreConstants.PACKAGE_BUILDER_ID, > args); > manipulator.commitChanges(monitor); > >@@ -234,7 +233,7 @@ > getProject().build(IncrementalProjectBuilder.FULL_BUILD, monitor); > if (!packageInactiveConfigs) { > // Reset builder Arguments >- manipulator.setBuilderArguments(IMTJCoreConstants.PACKAGE_BUILDER_ID, >+ manipulator.setBuilderArguments(org.eclipse.mtj.internal.core.IMTJCoreConstants.PACKAGE_BUILDER_ID, > new HashMap<String, String>()); > manipulator.commitChanges(monitor); > } else { >@@ -915,4 +914,12 @@ > getProject().build(IncrementalProjectBuilder.FULL_BUILD, monitor); > } > >+ @Override >+ public void createPackage(boolean obfuscate, >+ boolean packageInactiveConfigs, IProgressMonitor monitor) >+ throws CoreException { >+ // TODO Auto-generated method stub >+ >+ } >+ > } >Index: src/org/eclipse/mtj/internal/core/IMTJCoreConstants.java >=================================================================== >--- src/org/eclipse/mtj/internal/core/IMTJCoreConstants.java (revision 1342) >+++ src/org/eclipse/mtj/internal/core/IMTJCoreConstants.java (working copy) >@@ -76,7 +76,10 @@ > public static final String PREF_PREVERIFY_CONFIG_LOCATION = "preverify_config_location"; //$NON-NLS-1$ > public static final String PREF_PREVERIFY_CONFIG_VALUE = "preverify_config_value"; //$NON-NLS-1$ > public static final String PREF_DEFAULT_PREVERIFIER = "default_preverifier"; //$NON-NLS-1$ >- >+ public static final String PREF_PREVERIFY_TYPE = "preverify_type"; //$NON-NLS-1$ >+ public static final String PREF_PREVERIFY_TYPE_EMULATOR = "preverify_emulator"; //$NON-NLS-1$ >+ public static final String PREF_PREVERIFY_TYPE_PROGUARD = "preverify_proguard"; //$NON-NLS-1$ >+ > public static final String PREF_PREVERIFY_CONFIG_LOCATION_JAD = "jad"; //$NON-NLS-1$ > public static final String PREF_PREVERIFY_CONFIG_LOCATION_PLATFORM = "platform"; //$NON-NLS-1$ > public static final String PREF_PREVERIFY_CONFIG_LOCATION_SPECIFIED = "specified"; //$NON-NLS-1$ >Index: src/org/eclipse/mtj/internal/core/PreferenceAccessor.java >=================================================================== >--- src/org/eclipse/mtj/internal/core/PreferenceAccessor.java (revision 1342) >+++ src/org/eclipse/mtj/internal/core/PreferenceAccessor.java (working copy) >@@ -44,6 +44,8 @@ > * A helper wrapper around the more complex preferences supported by MTJ. > * > * @author Craig Setera >+ * >+ * Gustavo de Paula (Motorola) - Add proguard preverifier > */ > public class PreferenceAccessor { > >@@ -354,4 +356,17 @@ > > return prefNode; > } >+ >+ /** >+ * >+ * @param project >+ * @return >+ */ >+ public String getPreverifierType (IProject project) { >+ IEclipsePreferences preferences = getProjectPreferences(project, >+ IMTJCoreConstants.PREF_PREVERIFY_USE_PROJECT, >+ IMTJCoreConstants.PREF_PREVERIFY_TYPE); >+ return preferences.get(IMTJCoreConstants.PREF_PREVERIFY_TYPE, >+ MTJCorePreferenceInitializer.PREF_DEF_PREVERIFY_TYPE); >+ } > } >Index: src/org/eclipse/mtj/internal/core/MTJCorePreferenceInitializer.java >=================================================================== >--- src/org/eclipse/mtj/internal/core/MTJCorePreferenceInitializer.java (revision 1342) >+++ src/org/eclipse/mtj/internal/core/MTJCorePreferenceInitializer.java (working copy) >@@ -12,6 +12,8 @@ > * standards > * Hugo Raniere (Motorola) - Default value for default preverifier > * Gang Ma (Sybase) - Default value for preprocess debug level >+ * David Aragão (Motorola) - Add proguard preverifier refactoring >+ * > */ > package org.eclipse.mtj.internal.core; > >@@ -55,7 +57,9 @@ > public static final String PREF_DEF_PREVERIFY_CONFIG_LOCATION = PREF_PREVERIFY_CONFIG_LOCATION_PLATFORM; > public static final String PREF_DEF_PREVERIFY_CONFIG_VALUE = ""; //$NON-NLS-1$ > public static final String PREF_DEF_DEFAULT_PREVERIFIER = ""; //$NON-NLS-1$ >- >+ //public static final boolean PREF_DEF_PREVERIFY_BUILT_IN = false; >+ public static final String PREF_DEF_PREVERIFY_TYPE = IMTJCoreConstants.PREF_PREVERIFY_TYPE_EMULATOR; >+ > public static final String PREF_DEF_WTK_ROOT = ""; //$NON-NLS-1$ > public static final String PREF_DEF_ANTENNA_JAR = ""; //$NON-NLS-1$ > >@@ -103,9 +107,10 @@ > PREF_DEF_PREVERIFY_CONFIG_LOCATION); > prefs.setDefault(PREF_PREVERIFY_CONFIG_VALUE, > PREF_DEF_PREVERIFY_CONFIG_VALUE); >- prefs >- .setDefault(PREF_DEFAULT_PREVERIFIER, >- PREF_DEF_DEFAULT_PREVERIFIER); >+ prefs.setDefault(PREF_PREVERIFY_CONFIG_VALUE, >+ PREF_DEF_PREVERIFY_TYPE); >+ prefs.setDefault(PREF_DEFAULT_PREVERIFIER, >+ PREF_DEF_DEFAULT_PREVERIFIER); > > prefs.setDefault(PREF_ANTENNA_JAR, PREF_DEF_ANTENNA_JAR); > prefs.setDefault(PREF_WTK_ROOT, PREF_DEF_WTK_ROOT); >Index: src/org/eclipse/mtj/core/build/preverifier/ProguardPreverifier.java >=================================================================== >--- src/org/eclipse/mtj/core/build/preverifier/ProguardPreverifier.java (revision 0) >+++ src/org/eclipse/mtj/core/build/preverifier/ProguardPreverifier.java (revision 0) >@@ -0,0 +1,563 @@ >+/** >+ * Copyright (c) 2003,2008 Motorola Inc. and others. >+ * All Rights Reserved. >+ * Licensed under the Eclipse Public License - v 1.0 >+ * For more information see http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Gustavo de Paula (Motorola) - Initial Creation >+ */ >+package org.eclipse.mtj.core.build.preverifier; >+ >+import java.io.File; >+import java.io.FileFilter; >+import java.io.IOException; >+import java.util.ArrayList; >+import java.util.Arrays; >+import java.util.Iterator; >+import java.util.List; >+import java.util.regex.Matcher; >+import java.util.regex.Pattern; >+ >+import org.eclipse.core.resources.IFolder; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.debug.core.IStreamListener; >+import org.eclipse.debug.core.model.IProcess; >+import org.eclipse.debug.core.model.IStreamMonitor; >+import org.eclipse.debug.core.model.IStreamsProxy; >+import org.eclipse.jdt.core.IJavaProject; >+import org.eclipse.jdt.core.JavaModelException; >+import org.eclipse.jdt.launching.IVMInstall; >+import org.eclipse.jdt.launching.JavaRuntime; >+import org.eclipse.mtj.core.MTJCore; >+import org.eclipse.mtj.core.persistence.IPersistenceProvider; >+import org.eclipse.mtj.core.persistence.PersistenceException; >+import org.eclipse.mtj.core.project.IMTJProject; >+import org.eclipse.mtj.core.project.midp.IMidletSuiteProject; >+import org.eclipse.mtj.internal.core.IMTJCoreConstants; >+import org.eclipse.mtj.internal.core.build.BuildConsoleProxy; >+import org.eclipse.mtj.internal.core.build.BuildLoggingConfiguration; >+import org.eclipse.mtj.internal.core.build.IBuildConsoleProxy; >+import org.eclipse.mtj.internal.core.build.preverifier.IClassErrorInformation; >+import org.eclipse.mtj.internal.core.build.preverifier.PreverificationError; >+import org.eclipse.mtj.internal.core.build.preverifier.PreverificationErrorLocation; >+import org.eclipse.mtj.internal.core.build.preverifier.PreverificationErrorLocationType; >+import org.eclipse.mtj.internal.core.build.preverifier.PreverificationErrorType; >+import org.eclipse.mtj.internal.core.util.TemporaryFileManager; >+import org.eclipse.mtj.internal.core.util.Utils; >+import org.eclipse.mtj.internal.core.util.log.MTJLogger; >+ >+ >+/** >+ * Use proguard to preverify the MIDlet suite classes. Design and code is mostly >+ * based on org.eclipse.mtj.core.model.impl.StandardPreverifier. >+ * >+ * TODO Refactore code to have a common class to be used both by StandPreverifier and ProguardPreverifier >+ * >+ * @author wgp010 >+ */ >+public class ProguardPreverifier implements IPreverifier { >+ >+ /** >+ * The list of locations in which to look for the java executable in >+ * candidate VM install locations, relative to the VM install location. >+ * Code from org.eclipse.mtj.core.model.implJavaEmulatorDevice. >+ * TODO Refactore to have a common place for it >+ */ >+ private static final String[] CANDIDATE_JAVA_LOCATIONS = { >+ "bin" + File.separatorChar + "java", //$NON-NLS-2$ //$NON-NLS-1$ >+ "bin" + File.separatorChar + "java.exe", //$NON-NLS-2$ //$NON-NLS-1$ >+ "jre" + File.separatorChar + "bin" + File.separatorChar + "java", //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ >+ "jre" + File.separatorChar + "bin" + File.separatorChar + "java.exe" }; //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ >+ >+ /** >+ * Path to proguard lib >+ */ >+ private String proguardJarFilePath = null; >+ >+ /** >+ * Max number of characters in the command >+ */ >+ private static final int MAX_COMMAND_LENGTH = 2000; >+ >+ >+ // The regular expression we will use to match the preverify >+ // error >+ private static final String PREV_ERR_REGEX = "^Unable to access jarfile (\\S*)$"; >+ >+ // The compiled pattern for regular expression matching >+ private static final Pattern PREV_ERR_PATTERN = Pattern.compile( >+ PREV_ERR_REGEX, Pattern.MULTILINE); >+ >+ /** >+ * Class constructor >+ */ >+ public ProguardPreverifier () { >+ this.proguardJarFilePath = MTJCore.getProguardJarFile().getAbsolutePath(); >+ } >+ >+ @Override >+ public PreverificationError[] preverify(IMTJProject mtjProject, >+ IResource[] toVerify, IFolder outputFolder, IProgressMonitor monitor) >+ throws CoreException { >+ ArrayList allErrors = new ArrayList(); >+ >+ // Create the temporary file of commands for >+ // the verifier >+ ensureFolderExists(outputFolder, monitor); >+ >+ // construct the command line to call proguard >+ ArrayList baseArguments = constructCommandLine(); >+ >+ // read the final arguments that will be added to proguard command line. those parameters should be added >+ // after the -injar parameter >+ File outputFile = outputFolder.getLocation().toFile(); >+ String[] configurationParameters = getProguardFinalConfigurationParameters(mtjProject, outputFile.getAbsolutePath()); >+ >+ ArrayList arguments = new ArrayList(baseArguments); >+ >+ //add the output folder >+ addOutputToInJar (arguments, mtjProject); >+ >+ for (int i = 0; i < toVerify.length; i++) { >+ IResource resource = toVerify[i]; >+ >+ //add projects and jar files >+ switch (resource.getType()) { >+ case IResource.FOLDER: >+ case IResource.PROJECT: >+ addFileToInJar(arguments, resource.getLocation().toOSString()); >+ break; >+ >+ case IResource.FILE: >+ if (resource.getName().endsWith(".jar")) { >+ addFileToInJar(arguments, resource.getLocation().toOSString()); >+ } >+ break; >+ } >+ >+ if (commandLength(arguments) > MAX_COMMAND_LENGTH) { >+ // Configuration parameters >+ for (String configuration:configurationParameters) { >+ arguments.add(configuration); >+ } >+ >+ // Launch the system process >+ String[] commandLine = (String[]) arguments >+ .toArray(new String[arguments.size()]); >+ PreverificationError[] errors = runPreverifier(commandLine, >+ null, monitor); >+ allErrors.addAll(Arrays.asList(errors)); >+ >+ arguments = new ArrayList(baseArguments); >+ //add the output folder >+ addOutputToInJar (arguments, mtjProject); >+ } >+ } >+ >+ if (arguments.size() != baseArguments.size()) { >+ for (String configuration:configurationParameters) { >+ arguments.add(configuration); >+ } >+ >+ // Launch the system process >+ String[] commandLine = (String[]) arguments >+ .toArray(new String[arguments.size()]); >+ PreverificationError[] errors = runPreverifier(commandLine, null, >+ monitor); >+ allErrors.addAll(Arrays.asList(errors)); >+ } >+ >+ return (PreverificationError[]) allErrors >+ .toArray(new PreverificationError[allErrors.size()]); >+ } >+ >+ @Override >+ public PreverificationError[] preverifyJarFile( >+ IMTJProject mtjProject, File jarFile, >+ IFolder outputFolder, IProgressMonitor monitor) >+ throws CoreException{ >+ // Rather than trying to preverify a jar file, we will expand it >+ // first and then preverify against the expanded classes. >+ File srcDirectory = new File(""); >+ try { >+ srcDirectory = TemporaryFileManager.instance.createTempDirectory( >+ jarFile.getName().replace('.', '_') + "_", ".tmp"); >+ } catch (IOException ioe) { >+ IStatus status = new Status(IStatus.ERROR, >+ IMTJCoreConstants.PLUGIN_ID, "Failed to create directory.", >+ ioe); >+ throw new CoreException(status); >+ } >+ srcDirectory.mkdirs(); >+ >+ try { >+ Utils.extractArchive(jarFile, srcDirectory); >+ } catch (SecurityException se) { >+ IStatus status = new Status(IStatus.ERROR, >+ IMTJCoreConstants.PLUGIN_ID, >+ "Failed to inflate jar file due to a security violation.", >+ se); >+ throw new CoreException(status); >+ } catch (IOException ioe) { >+ IStatus status = new Status(IStatus.ERROR, >+ IMTJCoreConstants.PLUGIN_ID, "Failed to inflate jar file.", >+ ioe); >+ throw new CoreException(status); >+ } >+ >+ // Create the target directory for the preverification. We will >+ // tell the preverifier to use this when doing the preverification. >+ File tgtDirectory = new File(""); >+ try { >+ tgtDirectory = TemporaryFileManager.instance.createTempDirectory( >+ jarFile.getName().replace('.', '_') + "_", ".tmp"); >+ } catch (IOException ioe) { >+ IStatus status = new Status(IStatus.ERROR, >+ IMTJCoreConstants.PLUGIN_ID, "Failed to create directory.", >+ ioe); >+ throw new CoreException(status); >+ } >+ tgtDirectory.mkdirs(); >+ >+ ArrayList arguments = constructCommandLine(); >+ arguments.add(srcDirectory.toString()); >+ >+ // Launch the system process >+ String[] commandLine = (String[]) arguments >+ .toArray(new String[arguments.size()]); >+ PreverificationError[] errors = runPreverifier(commandLine, >+ null, monitor); >+ >+ // TODO we need to test the outcome of the previous before going much >+ // further >+ // here... >+ // Copy all of the non-class resources so they end up back in the >+ // jar file >+ FileFilter classFilter = new FileFilter() { >+ public boolean accept(File pathname) { >+ return pathname.isDirectory() >+ || !pathname.getName().endsWith(".class"); >+ } >+ }; >+ try { >+ Utils.copy(srcDirectory, tgtDirectory, classFilter); >+ } catch (SecurityException se) { >+ IStatus status = new Status(IStatus.ERROR, >+ IMTJCoreConstants.PLUGIN_ID, >+ "Failed copy specified source due to a security violation.", >+ se); >+ throw new CoreException(status); >+ } catch (IOException ioe) { >+ IStatus status = new Status(IStatus.ERROR, >+ IMTJCoreConstants.PLUGIN_ID, "Failed to copy specified source.", >+ ioe); >+ throw new CoreException(status); >+ } >+ >+ // Finally, re-jar the output of the pre-verification into the requested >+ // jar file... >+ File outputJarFile = new File(outputFolder.getLocation().toFile(), >+ jarFile.getName()); >+ try { >+ Utils.createArchive(outputJarFile, tgtDirectory); >+ } catch (IOException ioe) { >+ IStatus status = new Status(IStatus.ERROR, >+ IMTJCoreConstants.PLUGIN_ID, "Failed to create zip source folder.", >+ ioe); >+ throw new CoreException(status); >+ } >+ >+ return errors; >+ } >+ >+ public void loadUsing(IPersistenceProvider persistenceProvider) >+ throws PersistenceException { >+ // Not necessary to load any data >+ } >+ >+ public void storeUsing(IPersistenceProvider persistenceProvider) >+ throws PersistenceException { >+ // Not necessary to store any data >+ } >+ >+ /** >+ * Run the preverifier program and capture the errors that occurred during >+ * pre-verification. >+ * >+ * @param commandLine >+ * @param environment >+ * @throws CoreException >+ */ >+ private PreverificationError[] runPreverifier(String[] commandLine, >+ String[] environment, IProgressMonitor monitor) >+ throws CoreException { >+ final ArrayList errorList = new ArrayList(); >+ >+ IProcess process = Utils.launchApplication(commandLine, null, >+ environment, "Preverifier", "CLDC Preverifier"); >+ >+ // Listen on the process output streams >+ IStreamsProxy proxy = process.getStreamsProxy(); >+ if (BuildLoggingConfiguration.getInstance().isPreverifierOutputEnabled()) { >+ BuildConsoleProxy.getInstance() >+ .traceln("======================== Launching Preverification ========================="); >+ BuildConsoleProxy.getInstance().addConsoleStreamListener( >+ IBuildConsoleProxy.Stream.ERROR, proxy >+ .getErrorStreamMonitor()); >+ BuildConsoleProxy.getInstance().addConsoleStreamListener( >+ IBuildConsoleProxy.Stream.OUTPUT, proxy >+ .getOutputStreamMonitor()); >+ } >+ >+ proxy.getErrorStreamMonitor().addListener(new IStreamListener() { >+ public void streamAppended(String text, IStreamMonitor monitor) { >+ handleErrorReceived(text, errorList); >+ } >+ }); >+ >+ // Wait until completion >+ while ((!monitor.isCanceled()) && (!process.isTerminated())) { >+ try { >+ Thread.sleep(100); >+ } catch (InterruptedException e) { >+ } >+ ; >+ } >+ >+ if (BuildLoggingConfiguration.getInstance().isPreverifierOutputEnabled()) { >+ BuildConsoleProxy.getInstance() >+ .traceln("======================== Preverification exited with code: " >+ + process.getExitValue()); >+ } >+ >+ return (PreverificationError[]) errorList >+ .toArray(new PreverificationError[errorList.size()]); >+ } >+ >+ /** >+ * Handle the arrival of text on the error stream. >+ * >+ * TODO Change to support proguard error messages >+ * >+ * @param text >+ * @param errorList >+ */ >+ private void handleErrorReceived(String text, List errorList) { >+ text = text.trim(); >+ Matcher matcher = PREV_ERR_PATTERN.matcher(text); >+ if (matcher.find()) { >+ // Found a match for the error... >+ if (matcher.groupCount() > 0) { >+ final String classname = matcher.group(1); >+ >+ String errorText = "Error preverifying class"; >+ if (matcher.end() < text.length()) { >+ StringBuffer sb = new StringBuffer(errorText); >+ sb.append(": "); >+ >+ String detail = text.substring(matcher.end()); >+ detail = detail.trim(); >+ sb.append(detail); >+ errorText = sb.toString(); >+ } >+ >+ IClassErrorInformation classInfo = new IClassErrorInformation() { >+ public String getName() { >+ return classname; >+ } >+ >+ public String getSourceFile() { >+ return null; >+ } >+ }; >+ >+ PreverificationErrorLocation location = new PreverificationErrorLocation( >+ PreverificationErrorLocationType.UNKNOWN_LOCATION, >+ classInfo); >+ PreverificationError error = new PreverificationError( >+ PreverificationErrorType.UNKNOWN_ERROR, location, text); >+ errorList.add(error); >+ } >+ } else { >+ MTJLogger.log(IStatus.WARNING, text); >+ } >+ } >+ /** >+ * Ensure the specified output folder exists or create if it does not >+ * already exist. >+ * >+ * @param folder >+ * @param monitor >+ * @throws CoreException >+ */ >+ private void ensureFolderExists(IFolder folder, IProgressMonitor monitor) >+ throws CoreException { >+ // Make sure the output folder exists before we start >+ if (!folder.exists()) { >+ folder.create(true, true, monitor); >+ } >+ } >+ >+ /** >+ * Construct the command line for the specified pre-verification. >+ * >+ * @param midletProject >+ * @param target >+ * @return >+ * @throws CoreException >+ */ >+ private ArrayList constructCommandLine() throws CoreException { >+ ArrayList arguments = new ArrayList(); >+ >+ // The program we are running... >+ arguments.add(this.getJavaExecutable().getAbsolutePath()); >+ arguments.add("-jar"); >+ arguments.add(this.proguardJarFilePath); >+ >+ return arguments; >+ } >+ >+ /** >+ * Return the parameters to be used for controlling the proguard preverifier >+ * >+ * @param midletProject >+ * @return >+ * @throws CoreException if an error occurs working with the MIDlet project. >+ */ >+ private String [] getProguardFinalConfigurationParameters(IMTJProject mtjProject, String output) throws CoreException { >+ return new String [] { >+ "-outjars", >+ "'"+output+"'", >+ "-libraryjars", >+ this.getFullClasspath(mtjProject), >+ "'-ignorewarnings'", >+ "-dontusemixedcaseclassnames", >+ "-dontshrink", >+ "-dontoptimize", >+ "-dontobfuscate", >+ "-microedition" >+ }; >+ } >+ >+ /** >+ * Get the full classpath including all J2ME libraries. >+ * >+ * @param midletProject >+ * @return >+ * @throws CoreException >+ */ >+ private String getFullClasspath(IMTJProject mtjProject) >+ throws CoreException { >+ IJavaProject javaProject = mtjProject.getJavaProject(); >+ >+ String[] entries = JavaRuntime.computeDefaultRuntimeClassPath(javaProject); >+ >+ // start in 1 to remove the output folder from the runtime. the output folder should be included in the >+ // -injar proguard options >+ StringBuffer sb = new StringBuffer(); >+ for (int i = 1; i < entries.length; i++) { >+ if (i != 1) { >+ sb.append(File.pathSeparatorChar); >+ } >+ sb.append("'"+entries[i]+"'"); >+ } >+ >+ return sb.toString(); >+ } >+ >+ /** >+ * Add the output folder target to be verified. >+ * >+ * @param args >+ * @param resource >+ * @throws JavaModelException >+ */ >+ private void addOutputToInJar(List args, IMTJProject mtjProject) >+ throws JavaModelException { >+ >+ // Find the source directory this class resides in >+ String outputPath = null; >+ >+ String s1 = mtjProject.getProject().getLocation().toOSString(); >+ String s2 = mtjProject.getJavaProject().getOutputLocation().removeFirstSegments(1).toOSString(); >+ //IPath.SEPARATOR >+ outputPath = s1 + File.separatorChar + s2; >+ >+ if (outputPath != null) { >+ args.add("-injars"); >+ args.add("'"+outputPath+"'"); >+ } >+ } >+ >+ /** >+ * Add any file to be preverified >+ * >+ * @param args >+ * @param resource >+ * @throws JavaModelException >+ */ >+ private void addFileToInJar(List args, String filePath) >+ throws JavaModelException { >+ if (filePath != null) { >+ args.add("-injars"); >+ args.add("'"+filePath+"'"); >+ } >+ } >+ >+ >+ /** >+ * Return the length of the command-line length given the specified argument >+ * list. >+ * >+ * @param arguments >+ * @return >+ */ >+ private int commandLength(ArrayList arguments) { >+ int length = 0; >+ >+ Iterator iter = arguments.iterator(); >+ while (iter.hasNext()) { >+ Object arg = (Object) iter.next(); >+ length += arg.toString().length(); >+ if (iter.hasNext()) >+ length++; >+ } >+ >+ return length; >+ } >+ >+ /** >+ * Return the Java executable to be used for launching this device. >+ * Code from org.eclipse.mtj.core.model.implJavaEmulatorDevice. >+ * TODO Refactore to have a common place for it >+ * >+ * @return >+ */ >+ private File getJavaExecutable() { >+ File executable = null; >+ >+ IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall(); >+ File installLocation = vmInstall.getInstallLocation(); >+ >+ for (int i = 0; i < CANDIDATE_JAVA_LOCATIONS.length; i++) { >+ String javaLocation = CANDIDATE_JAVA_LOCATIONS[i]; >+ File javaExecutable = new File(installLocation, javaLocation); >+ if (javaExecutable.exists()) { >+ executable = javaExecutable; >+ break; >+ } >+ } >+ return executable; >+ } >+ >+ @Override >+ public File getPreverifierExecutable() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/mtj/core/IMTJCoreConstants.java >=================================================================== >--- src/org/eclipse/mtj/core/IMTJCoreConstants.java (revision 0) >+++ src/org/eclipse/mtj/core/IMTJCoreConstants.java (revision 0) >@@ -0,0 +1,207 @@ >+/** >+ * Copyright (c) 2003,2009 Craig Setera and others. >+ * >+ * All Rights Reserved. >+ * Licensed under the Eclipse Public License - v 1.0 >+ * For more information see http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Craig Setera (EclipseME) - Initial implementation >+ * Diego Sandin (Motorola) - Refactoring package and class name >+ * to follow eclipse standards >+ * Hugo Raniere (Motorola) - Removing Preprocessor code >+ * Feng Wang (Sybase) - Add LAUNCH_FROM_JAD_FOLDER constant for >+ * launching from JAD. >+ * Hugo Raniere (Motorola) - Adding key to represent default preverifier >+ * Diego Sandin (Motorola) - Re-enabling Preprocessor code >+ * Hugo Raniere (Motorola) - Adding key to represent a java me problem marker >+ * Diego Sandin (Motorola) - Adding key to represent a missing device definition >+ * problem marker >+ * Gang Ma (Sybase) - Adding key to represent preprocess debug level >+ * David Marques(Motorola) - Adding key to represent process type. >+ * David Marques(Motorola) - Adding L10N Nature Constant. >+ * Gustavo de Paula (Motorola) - Add types of preverifiers >+ * >+ */ >+package org.eclipse.mtj.core; >+ >+/** >+ * Constant definitions for use throughout the plug-in. >+ * <p> >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as part >+ * of a work in progress. There is no guarantee that this API will work or that >+ * it will remain the same. Please do not use this API without consulting with >+ * the MTJ team. >+ * </p> >+ * >+ * @since 1.0 >+ * @noimplement This interface is not intended to be implemented by clients. >+ */ >+public interface IMTJCoreConstants { >+ >+ // The plug-in ID >+ public static final String PLUGIN_ID = "org.eclipse.mtj.core"; //$NON-NLS-1$ >+ >+ // Directory preference keys and defaults >+ public static final String PREF_DEPLOYMENT_DIR = "deployment_dir"; //$NON-NLS-1$ >+ public static final String PREF_VERIFIED_DIR = "verified_dir"; //$NON-NLS-1$ >+ >+ // New project creation preferences >+ public static final String PREF_USE_RESOURCES_DIR = "use_resources_dir"; //$NON-NLS-1$ >+ public static final String PREF_RESOURCES_DIR = "resources_dir"; //$NON-NLS-1$ >+ public static final String PREF_FORCE_JAVA11 = "force_java11"; //$NON-NLS-1$ >+ >+ // Over the Air preferences >+ public static final String PREF_OTA_SERVER_START_AT_START = "ota_start_at_start"; //$NON-NLS-1$ >+ public static final String PREF_OTA_PORT_DEFINED = "ota_port_defined"; //$NON-NLS-1$ >+ public static final String PREF_OTA_PORT = "ota_port"; //$NON-NLS-1$ >+ public static final String PREF_OTA_AUTODEPLOY = "ota_autodeploy"; //$NON-NLS-1$ >+ >+ // Proguard obfuscation preferences >+ public static final String PREF_OBFUSCATION_USE_PROJECT = "obfuscate_use_project"; //$NON-NLS-1$ >+ public static final String PREF_PROGUARD_DIR = "proguard_dir"; //$NON-NLS-1$ >+ public static final String PREF_PROGUARD_USE_SPECIFIED = "proguard_use_specified"; //$NON-NLS-1$ >+ public static final String PREF_PROGUARD_OPTIONS = "proguard_options"; //$NON-NLS-1$ >+ public static final String PREF_PROGUARD_KEEP = "proguard_keep"; //$NON-NLS-1$ >+ >+ // Packaging related preferences >+ public static final String PREF_PKG_USE_PROJECT = "pkg_use_project"; //$NON-NLS-1$ >+ public static final String PREF_PKG_AUTOVERSION = "pkg_autoversion"; //$NON-NLS-1$ >+ public static final String PREF_PKG_EXCLUDED_PROPS = "pkg_excluded_props"; //$NON-NLS-1$ >+ public static final String PREF_PKG_BUILD_XML = "pkg_build_xml"; //$NON-NLS-1$ >+ >+ // Preverifier related preferences >+ public static final String PREF_PREVERIFY_USE_PROJECT = "pkg_use_project"; //$NON-NLS-1$ >+ >+ public static final String PREF_PREVERIFY_CONFIG_LOCATION = "preverify_config_location"; //$NON-NLS-1$ >+ public static final String PREF_PREVERIFY_CONFIG_VALUE = "preverify_config_value"; //$NON-NLS-1$ >+ public static final String PREF_DEFAULT_PREVERIFIER = "default_preverifier"; //$NON-NLS-1$ >+ public static final String PREF_PREVERIFY_TYPE = "preverify_type"; >+ public static final String PREF_PREVERIFY_TYPE_EMULATOR = "preverify_emulator"; >+ public static final String PREF_PREVERIFY_TYPE_DEFAULT = "preverify_default"; >+ public static final String PREF_PREVERIFY_TYPE_PROGUARD = "preverify_proguard"; >+ >+ public static final String PREF_PREVERIFY_CONFIG_LOCATION_JAD = "jad"; //$NON-NLS-1$ >+ public static final String PREF_PREVERIFY_CONFIG_LOCATION_PLATFORM = "platform"; //$NON-NLS-1$ >+ public static final String PREF_PREVERIFY_CONFIG_LOCATION_SPECIFIED = "specified"; //$NON-NLS-1$ >+ >+ public static final String MANIFEST_FILE_NAME = "META-INF/MANIFEST.MF"; >+ >+ // Antenna settings >+ public static final String PREF_WTK_ROOT = "wtk_root"; //$NON-NLS-1$ >+ public static final String PREF_ANTENNA_JAR = "antenna_jar"; //$NON-NLS-1$ >+ >+ // Miscellaneous preferences >+ public static final String PREF_RMTDBG_TIMEOUT = "rmt_debug_delay"; //$NON-NLS-1$ >+ public static final String PREF_RMTDBG_INTERVAL = "rmt_debug_poll_interval"; //$NON-NLS-1$ >+ public static final String PREF_AUTO_LAUNCH_MIGRATION = "auto_launch_migration"; //$NON-NLS-1$ >+ >+ // Preprocessor preferences >+ public static final String PREF_PREPROCESS_USE_PROJECT = "preprocess_use_project"; //$NON-NLS-1$ >+ public static final String PREF_PREPROCESS_DEBUG_LEVEL = "preprocess_debuglevel"; //$NON-NLS-1$ >+ >+ /** >+ * Debugging property keys Key that uses "true" or "false" to control >+ * whether or not to dump the launch command line for the emulator >+ */ >+ public static final String PROP_DUMP_LAUNCH = "mtj.dump.launch"; //$NON-NLS-1$ >+ >+ /** The superclass of all MIDlets */ >+ public static final String MIDLET_SUPERCLASS = "javax.microedition.midlet.MIDlet"; //$NON-NLS-1$ >+ >+ // Project folder names... >+ >+ /** >+ * The directory used to hold temporary files such as preverified and >+ * incrementally built jar files >+ */ >+ public static final String TEMP_FOLDER_NAME = ".mtj.tmp"; //$NON-NLS-1$ >+ >+ /** >+ * The sub-folder of the TEMP folder that holds runtime classes >+ */ >+ public static final String RUNTIME_FOLDER_NAME = "runtime"; >+ >+ // The sub-folder of the TEMP folder that holds verified classes and >+ // libraries >+ public static final String VERIFIED_FOLDER_NAME = "verified"; //$NON-NLS-1$ >+ >+ // The sub-folder of the TEMP folder that holds the JAR and JAD files for >+ // execution by the emulator >+ public static final String EMULATION_FOLDER_NAME = "emulation"; //$NON-NLS-1$ >+ >+ // The sub-folder of the ".mtj.tmp" folder that holds JAR and JAD for >+ // launching from JAD emulation >+ public static final String LAUNCH_FROM_JAD_FOLDER = "launchFromJAD"; //$NON-NLS-1$ >+ >+ // Miscellaneous >+ public static final String PROGUARD_JAR = "proguard.jar"; //$NON-NLS-1$ >+ >+ public static final String MTJ_NATURE_ID = PLUGIN_ID + ".nature"; //$NON-NLS-1$ >+ public static final String J2ME_PREPROCESSED_NATURE_ID = PLUGIN_ID >+ + ".preprocessedNature"; //$NON-NLS-1$ >+ >+ public static final String J2ME_PREPROCESSING_NATURE_ID = PLUGIN_ID >+ + ".preprocessingNature"; //$NON-NLS-1$ >+ public static final String J2ME_PREVERIFIER_ID = PLUGIN_ID + ".preverifier"; //$NON-NLS-1$ >+ public static final String J2ME_PREPROCESSOR_ID = PLUGIN_ID >+ + ".preprocessor"; //$NON-NLS-1$ >+ public static final String JAVAME_PROBLEM_MARKER = PLUGIN_ID + ".problem"; //$NON-NLS-1$ >+ >+ /** >+ * Missing device definition resource marker ID >+ */ >+ public static final String JAVAME_MISSING_DEVICE_MARKER = PLUGIN_ID >+ + ".device.missing"; //$NON-NLS-1$ >+ >+ public static final String J2ME_PREPROCESSED_CONTAINER = PLUGIN_ID >+ + ".PP_CONTAINER"; //$NON-NLS-1$ >+ public static final String J2ME_TOOLKIT_TYPES_ID = "wirelessToolkitTypes"; //$NON-NLS-1$ >+ public static final String J2ME_CONFIGURATIONS_ID = "configurations"; //$NON-NLS-1$ >+ public static final String J2ME_PROFILES_ID = "profiles"; //$NON-NLS-1$ >+ >+ public static final String MTJ_PROCESS_TYPE = "MTJProcess"; //$NON-NLS-1$ >+ >+ // //////////////////////////////////////////////////////////////////// >+ // Error messages >+ // //////////////////////////////////////////////////////////////////// >+ /** No MIDlets defined during OTA launch */ >+ public static final int ERR_OTA_NO_MIDLETS = 100; >+ >+ /** Errors occurred during obfuscation */ >+ public static final int ERR_OBFUSCATION_ERRORS = 101; >+ >+ /** Error searching for jar executable */ >+ public static final int ERR_COULD_NOT_FIND_JAR_TOOL = 102; >+ >+ /** Need signature passwords (not really an error, but triggers a dialog) */ >+ public static final int INFO_NEED_SIGNATURE_PASSWORDS = 103; >+ >+ /** >+ * Need check for debug setting(not really an error, but triggers a dialog >+ * if the current debugger setting is not satisfied to debug a MIDlet) >+ */ >+ public static final int INFO_DEBUGGER_SETTINGS_CHECK = 104; >+ >+ /** >+ * This constant is the old eclipse me nature id. >+ */ >+ public static final String ECLIPSE_ME_NATURE = "eclipseme.core.nature"; //$NON-NLS-1$ >+ >+ /** >+ * This constant holds the L10N Nature ID >+ */ >+ public static final String L10N_NATURE_ID = PLUGIN_ID + ".l10nNature"; //$NON-NLS-1$ >+ >+ /** >+ * This constant holds the L10N Builder ID >+ */ >+ public static final String L10N_BUILDER_ID = PLUGIN_ID + ".l10nBuilder"; //$NON-NLS-1$ >+ >+ /** >+ * This constant holds the JMUnit Nature ID >+ */ >+ public static final String JMUNIT_NATURE_ID = "org.eclipse.mtj.jmunit.jmunitNature"; //$NON-NLS-1$ >+ >+ public static final String VERSION_NLS_BIND_TEMPLATE = "{0}.{1}"; >+} >#P org.eclipse.mtj.ui >Index: src/org/eclipse/mtj/internal/ui/preferences/PreverificationPreferencePage.java >=================================================================== >--- src/org/eclipse/mtj/internal/ui/preferences/PreverificationPreferencePage.java (revision 1342) >+++ src/org/eclipse/mtj/internal/ui/preferences/PreverificationPreferencePage.java (working copy) >@@ -16,6 +16,8 @@ > * correcting "Restore Defaults" behavior > * Diego Sandin (Motorola) - Use Eclipse Message Bundles [Bug 255874] > * Gustavo de Paula (Motorola) - Preverifier api refactoring >+ * Gustavo de Paula (Motorola) - Change preverification to add proguard support >+ * David Aragao (Motorola) - Preverification type availability > */ > package org.eclipse.mtj.internal.ui.preferences; > >@@ -33,10 +35,14 @@ > import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.SubProgressMonitor; > import org.eclipse.core.runtime.preferences.IEclipsePreferences; >+import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jface.operation.IRunnableWithProgress; >+import org.eclipse.jface.preference.FieldEditorPreferencePage; > import org.eclipse.jface.preference.FileFieldEditor; > import org.eclipse.jface.preference.IPreferenceStore; >-import org.eclipse.jface.preference.PreferencePage; >+import org.eclipse.jface.preference.RadioGroupFieldEditor; >+import org.eclipse.jface.util.IPropertyChangeListener; >+import org.eclipse.jface.util.PropertyChangeEvent; > import org.eclipse.mtj.core.MTJCore; > import org.eclipse.mtj.core.build.preverifier.IPreverifier; > import org.eclipse.mtj.core.sdk.device.IAPI; >@@ -41,6 +47,7 @@ > import org.eclipse.mtj.core.build.preverifier.IPreverifier; > import org.eclipse.mtj.core.sdk.device.IAPI; > import org.eclipse.mtj.internal.core.IMTJCoreConstants; >+import org.eclipse.mtj.internal.core.PreferenceAccessor; > import org.eclipse.mtj.internal.core.sdk.device.midp.Configuration; > import org.eclipse.mtj.internal.core.util.log.MTJLogger; > import org.eclipse.mtj.internal.ui.IEmbeddableWorkbenchPreferencePage; >@@ -64,416 +71,528 @@ > * > * @author Craig Setera > */ >-public class PreverificationPreferencePage extends PreferencePage implements >- IEmbeddableWorkbenchPreferencePage { >+public class PreverificationPreferencePage extends FieldEditorPreferencePage >+ implements IEmbeddableWorkbenchPreferencePage { >+ >+ private static final String[] BUTTON_TEXTS = new String[] { >+ MTJUIMessages.PreverificationPreferencePage_use_jad_settings_label_text, >+ MTJUIMessages.PreverificationPreferencePage_use_project_settings_label_text, >+ MTJUIMessages.PreverificationPreferencePage_use_specific_config_label_text, }; >+ >+ private static final String[] CONFIG_FILE_LOCATIONS = new String[] { >+ IMTJCoreConstants.PREF_PREVERIFY_CONFIG_LOCATION_JAD, >+ IMTJCoreConstants.PREF_PREVERIFY_CONFIG_LOCATION_PLATFORM, >+ IMTJCoreConstants.PREF_PREVERIFY_CONFIG_LOCATION_SPECIFIED, }; >+ >+ private Combo configCombo; >+ private IAPI[] configSpecs; >+ private FileFieldEditor defaultPreverifierField; >+ private Group defaultPreverifierGroup; >+ private boolean embeddedInProperties; > >- private static final String[] BUTTON_TEXTS = new String[] { >- MTJUIMessages.PreverificationPreferencePage_use_jad_settings_label_text, >- MTJUIMessages.PreverificationPreferencePage_use_project_settings_label_text, >- MTJUIMessages.PreverificationPreferencePage_use_specific_config_label_text, }; >+ // The java project on which this MIDlet suite is based >+ private IJavaProject javaProject; > >- private static final String[] CONFIG_FILE_LOCATIONS = new String[] { >- IMTJCoreConstants.PREF_PREVERIFY_CONFIG_LOCATION_JAD, >- IMTJCoreConstants.PREF_PREVERIFY_CONFIG_LOCATION_PLATFORM, >- IMTJCoreConstants.PREF_PREVERIFY_CONFIG_LOCATION_SPECIFIED, }; >+ private Button[] preverificationRadios; > >- private Combo configCombo; >- private IAPI[] configSpecs; >- private FileFieldEditor defaultPreverifierField; >- private boolean embeddedInProperties; >+ private RadioGroupFieldEditor radioGroupFieldEditor; > >- private Button[] preverificationRadios; >+ /** >+ * Default constructor. >+ */ >+ public PreverificationPreferencePage() { >+ this(false, MTJUIPlugin.getDefault().getCorePreferenceStore()); >+ } > >- /** >- * Default constructor. >- */ >- public PreverificationPreferencePage() { >- this(false, MTJUIPlugin.getDefault().getCorePreferenceStore()); >- } >+ /** >+ * Constructor for use when embedding the preference page within a >+ * properties page. >+ * >+ * @param embeddedInProperties >+ * @param preferenceStore >+ * a table mapping named preferences to values >+ */ >+ public PreverificationPreferencePage(boolean embeddedInProperties, >+ IPreferenceStore preferenceStore) { > >- /** >- * Constructor for use when embedding the preference page within a >- * properties page. >- * >- * @param embeddedInProperties >- * @param preferenceStore a table mapping named preferences to values >- */ >- public PreverificationPreferencePage(boolean embeddedInProperties, >- IPreferenceStore preferenceStore) { >+ this.embeddedInProperties = embeddedInProperties; >+ setPreferenceStore(preferenceStore); >+ configSpecs = Configuration.values(); >+ } > >- this.embeddedInProperties = embeddedInProperties; >- setPreferenceStore(preferenceStore); >- configSpecs = Configuration.values(); >- } >+ /** >+ * Launch the build of the MIDlet suites. >+ * >+ * @param toBuild >+ */ >+ public void doBuild(final IProject[] toBuild) { >+ // The work to be done. >+ IRunnableWithProgress runnable = new IRunnableWithProgress() { >+ public void run(IProgressMonitor monitor) >+ throws InvocationTargetException { >+ try { >+ for (int i = 0; i < toBuild.length; i++) { >+ SubProgressMonitor subMonitor = new SubProgressMonitor( >+ monitor, IProgressMonitor.UNKNOWN); >+ toBuild[i].build(IncrementalProjectBuilder.FULL_BUILD, >+ subMonitor); >+ subMonitor.done(); >+ } >+ } catch (CoreException e) { >+ throw new InvocationTargetException(e); >+ } >+ } >+ }; >+ try { >+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile( >+ runnable); >+ } catch (InterruptedException e) { >+ } catch (InvocationTargetException e) { >+ MTJLogger >+ .log( >+ IStatus.WARNING, >+ MTJUIMessages.PreverificationPreferencePage_error_build_suite, >+ e.getCause()); >+ } >+ } > >- /** >- * Launch the build of the MIDlet suites. >- * >- * @param toBuild >- */ >- public void doBuild(final IProject[] toBuild) { >- // The work to be done. >- IRunnableWithProgress runnable = new IRunnableWithProgress() { >- public void run(IProgressMonitor monitor) >- throws InvocationTargetException { >- try { >- for (int i = 0; i < toBuild.length; i++) { >- SubProgressMonitor subMonitor = new SubProgressMonitor( >- monitor, IProgressMonitor.UNKNOWN); >- toBuild[i].build(IncrementalProjectBuilder.FULL_BUILD, >- subMonitor); >- subMonitor.done(); >- } >- } catch (CoreException e) { >- throw new InvocationTargetException(e); >- } >- } >- }; >- try { >- PlatformUI.getWorkbench().getProgressService().busyCursorWhile( >- runnable); >- } catch (InterruptedException e) { >- } catch (InvocationTargetException e) { >- MTJLogger >- .log( >- IStatus.WARNING, >- MTJUIMessages.PreverificationPreferencePage_error_build_suite, >- e.getCause()); >- } >- } >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) >+ */ >+ public void init(IWorkbench workbench) { >+ } > >- /* (non-Javadoc) >- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) >- */ >- public void init(IWorkbench workbench) { >- } >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.preference.PreferencePage#performApply() >+ */ >+ @Override >+ public void performApply() { >+ super.performApply(); >+ } > >- /* (non-Javadoc) >- * @see org.eclipse.jface.preference.PreferencePage#performApply() >- */ >- @Override >- public void performApply() { >- super.performApply(); >- } >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults() >+ */ >+ @Override >+ public void performDefaults() { >+ setControlsFromDefaults(); >+ super.performDefaults(); >+ } > >- /* (non-Javadoc) >- * @see org.eclipse.jface.preference.PreferencePage#performDefaults() >- */ >- @Override >- public void performDefaults() { >- setControlsFromDefaults(); >- super.performDefaults(); >- } >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.preference.PreferencePage#performOk() >+ */ >+ @Override >+ public boolean performOk() { >+ setPreferencesFromControls(); >+ if (!embeddedInProperties) { >+ buildSuites(); >+ } > >- /* (non-Javadoc) >- * @see org.eclipse.jface.preference.PreferencePage#performOk() >- */ >- @Override >- public boolean performOk() { >- setPreferencesFromControls(); >- if (!embeddedInProperties) { >- buildSuites(); >- } >+ return super.performOk(); >+ } > >- return super.performOk(); >- } >+ /** >+ * Add the controls for choosing the preverification configuration. >+ * >+ * @param composite >+ */ >+ private void addConfigurationControls(Composite composite) { >+ Group preverifyConfigGroup = new Group(composite, SWT.NONE); >+ preverifyConfigGroup >+ .setText(MTJUIMessages.PreverificationPreferencePage_preverifyConfigGroup_label_text); >+ preverifyConfigGroup.setLayout(new GridLayout(1, false)); >+ preverifyConfigGroup.setLayoutData(new GridData( >+ GridData.FILL_HORIZONTAL)); > >- /** >- * Add the controls for choosing the preverification configuration. >- * >- * @param composite >- */ >- private void addConfigurationControls(Composite composite) { >- Group preverifyConfigGroup = new Group(composite, SWT.NONE); >- preverifyConfigGroup >- .setText(MTJUIMessages.PreverificationPreferencePage_preverifyConfigGroup_label_text); >- preverifyConfigGroup.setLayout(new GridLayout(1, false)); >- preverifyConfigGroup.setLayoutData(new GridData( >- GridData.FILL_HORIZONTAL)); >+ preverificationRadios = new Button[BUTTON_TEXTS.length]; >+ for (int i = 0; i < BUTTON_TEXTS.length; i++) { >+ preverificationRadios[i] = new Button(preverifyConfigGroup, >+ SWT.RADIO); >+ preverificationRadios[i].setText(BUTTON_TEXTS[i]); > >- preverificationRadios = new Button[BUTTON_TEXTS.length]; >- for (int i = 0; i < BUTTON_TEXTS.length; i++) { >- preverificationRadios[i] = new Button(preverifyConfigGroup, >- SWT.RADIO); >- preverificationRadios[i].setText(BUTTON_TEXTS[i]); >+ if (CONFIG_FILE_LOCATIONS[i] >+ .equals(IMTJCoreConstants.PREF_PREVERIFY_CONFIG_LOCATION_SPECIFIED)) { >+ addSpecificConfigurationControls(preverifyConfigGroup); >+ } >+ } >+ } > >- if (CONFIG_FILE_LOCATIONS[i] >- .equals(IMTJCoreConstants.PREF_PREVERIFY_CONFIG_LOCATION_SPECIFIED)) { >- addSpecificConfigurationControls(preverifyConfigGroup); >- } >- } >- } >+ /** >+ * Add the controls for setting the default preverifier. >+ * >+ * @param composite >+ */ >+ private void addDefaultPreverifierControls(Composite composite) { >+ defaultPreverifierGroup = new Group(composite, SWT.NONE); >+ defaultPreverifierGroup >+ .setText(MTJUIMessages.PreverificationPreferencePage_defaultPreverifierGroup_label_text); >+ defaultPreverifierGroup.setLayout(new GridLayout(3, false)); >+ defaultPreverifierGroup.setLayoutData(new GridData( >+ GridData.FILL_HORIZONTAL)); > >- /** >- * Add the controls for setting the default preverifier. >- * >- * @param composite >- */ >- private void addDefaultPreverifierControls(Composite composite) { >- Group defaultPreverifierGroup = new Group(composite, SWT.NONE); >- defaultPreverifierGroup >- .setText(MTJUIMessages.PreverificationPreferencePage_defaultPreverifierGroup_label_text); >- defaultPreverifierGroup.setLayout(new GridLayout(3, false)); >- defaultPreverifierGroup.setLayoutData(new GridData( >- GridData.FILL_HORIZONTAL)); >+ Label tip = new Label(defaultPreverifierGroup, SWT.NONE); >+ tip >+ .setText(MTJUIMessages.PreverificationPreferencePage_defaultPreverifierTip_label_text); >+ GridData gd = new GridData(); >+ gd.horizontalSpan = 3; >+ gd.verticalIndent = 10; >+ tip.setLayoutData(gd); > >- Label tip = new Label(defaultPreverifierGroup, SWT.NONE); >- tip >- .setText(MTJUIMessages.PreverificationPreferencePage_defaultPreverifierTip_label_text); >- GridData gd = new GridData(); >- gd.horizontalSpan = 3; >- gd.verticalIndent = 10; >- tip.setLayoutData(gd); >+ defaultPreverifierField = new FileFieldEditor( >+ IMTJCoreConstants.PREF_DEFAULT_PREVERIFIER, >+ MTJUIMessages.PreverificationPreferencePage_defaultPreverifierField_label_text, >+ defaultPreverifierGroup); > >- defaultPreverifierField = new FileFieldEditor( >- IMTJCoreConstants.PREF_DEFAULT_PREVERIFIER, >- MTJUIMessages.PreverificationPreferencePage_defaultPreverifierField_label_text, >- defaultPreverifierGroup); >+ String[] extensions = null; >+ if (Platform.getOS().equals(Platform.OS_WIN32)) { >+ extensions = new String[] { "*.exe" }; //$NON-NLS-1$ >+ } >+ defaultPreverifierField.setFileExtensions(extensions); >+ defaultPreverifierField.setPreferenceStore(getPreferenceStore()); >+ } > >- String[] extensions = null; >- if (Platform.getOS().equals(Platform.OS_WIN32)) { >- extensions = new String[] { "*.exe" }; //$NON-NLS-1$ >- } >- defaultPreverifierField.setFileExtensions(extensions); >- defaultPreverifierField.setPreferenceStore(getPreferenceStore()); >- } >+ /** >+ * Add the configuration specific controls. >+ * >+ * @param preverifyConfigGroup >+ * @throws CoreException >+ */ >+ private void addSpecificConfigurationControls(Group preverifyConfigGroup) { >+ configCombo = new Combo(preverifyConfigGroup, SWT.READ_ONLY); >+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL); >+ gridData.horizontalIndent = 15; >+ configCombo.setLayoutData(gridData); > >- /** >- * Add the configuration specific controls. >- * >- * @param preverifyConfigGroup >- * @throws CoreException >- */ >- private void addSpecificConfigurationControls(Group preverifyConfigGroup) { >- configCombo = new Combo(preverifyConfigGroup, SWT.READ_ONLY); >- GridData gridData = new GridData(GridData.FILL_HORIZONTAL); >- gridData.horizontalIndent = 15; >- configCombo.setLayoutData(gridData); >+ String[] displayValues = new String[configSpecs.length]; >+ for (int i = 0; i < displayValues.length; i++) { >+ displayValues[i] = configSpecs[i].getName(); >+ } > >- String[] displayValues = new String[configSpecs.length]; >- for (int i = 0; i < displayValues.length; i++) { >- displayValues[i] = configSpecs[i].getName(); >- } >+ configCombo.setItems(displayValues); >+ } > >- configCombo.setItems(displayValues); >- } >+ /** >+ * Build the midlet suites in the workspace because preverification settings >+ * have changed. >+ */ >+ private void buildSuites() { >+ // TODO Add some more smarts to what needs to get rebuilt. >+ IWorkspaceRoot root = MTJCore.getWorkspace().getRoot(); >+ IProject[] projects = root.getProjects(); > >- /** >- * Build the midlet suites in the workspace because preverification settings >- * have changed. >- */ >- private void buildSuites() { >- // TODO Add some more smarts to what needs to get rebuilt. >- IWorkspaceRoot root = MTJCore.getWorkspace().getRoot(); >- IProject[] projects = root.getProjects(); >+ ArrayList<IProject> toBuild = new ArrayList<IProject>(); > >- ArrayList<IProject> toBuild = new ArrayList<IProject>(); >+ // Collect the projects to be built >+ for (int i = 0; i < projects.length; i++) { >+ IProject project = projects[i]; > >- // Collect the projects to be built >- for (int i = 0; i < projects.length; i++) { >- IProject project = projects[i]; >+ try { >+ if (project.isOpen() >+ && project.hasNature(IMTJCoreConstants.MTJ_NATURE_ID) >+ && !usesProjectSpecificPreverification(project)) { >+ toBuild.add(project); >+ } >+ } catch (CoreException e) { >+ MTJLogger >+ .log( >+ IStatus.ERROR, >+ MTJUIMessages.PreverificationPreferencePage_error_build_midlet_suite, >+ e); >+ } >+ } > >- try { >- if (project.isOpen() >- && project.hasNature(IMTJCoreConstants.MTJ_NATURE_ID) >- && !usesProjectSpecificPreverification(project)) { >- toBuild.add(project); >- } >- } catch (CoreException e) { >- MTJLogger >- .log( >- IStatus.ERROR, >- MTJUIMessages.PreverificationPreferencePage_error_build_midlet_suite, >- e); >- } >- } >+ // Do the build of those projects >+ IProject[] projectArray = toBuild.toArray(new IProject[toBuild.size()]); >+ if (projectArray.length > 0) { >+ doBuild(projectArray); >+ } >+ } > >- // Do the build of those projects >- IProject[] projectArray = toBuild.toArray(new IProject[toBuild.size()]); >- if (projectArray.length > 0) { >- doBuild(projectArray); >- } >- } >+ private void setControlsFromDefaults() { >+ if (preverificationRadios != null) { >+ IPreferenceStore store = getPreferenceStore(); >+ String location = store >+ .getDefaultString(IMTJCoreConstants.PREF_PREVERIFY_CONFIG_LOCATION); >+ for (int i = 0; i < preverificationRadios.length; i++) { >+ String fieldValue = CONFIG_FILE_LOCATIONS[i]; >+ preverificationRadios[i].setSelection(fieldValue >+ .equals(location)); >+ } >+ >+ >+ IPreferenceStore preverifierTypestore = radioGroupFieldEditor >+ .getPreferenceStore(); >+ >+ String preverifyType = preverifierTypestore >+ .getString(IMTJCoreConstants.PREF_PREVERIFY_TYPE); >+ if (preverifyType.equals("preverify_default")) { >+ defaultPreverifierField.setEnabled(true, >+ defaultPreverifierGroup); >+ } else { >+ defaultPreverifierField.setEnabled(false, >+ defaultPreverifierGroup); >+ } > >- private void setControlsFromDefaults() { >- if (preverificationRadios != null) { >- IPreferenceStore store = getPreferenceStore(); >- String location = store >- .getDefaultString(IMTJCoreConstants.PREF_PREVERIFY_CONFIG_LOCATION); >- for (int i = 0; i < preverificationRadios.length; i++) { >- String fieldValue = CONFIG_FILE_LOCATIONS[i]; >- preverificationRadios[i].setSelection(fieldValue >- .equals(location)); >- } >+ int specIndex = 0; >+ String config = store >+ .getDefaultString(IMTJCoreConstants.PREF_PREVERIFY_CONFIG_VALUE); >+ for (int i = 0; i < configSpecs.length; i++) { >+ IAPI spec = configSpecs[i]; >+ if (spec.getIdentifier().equals(config)) { >+ specIndex = i; >+ break; >+ } >+ } > >- int specIndex = 0; >- String config = store >- .getDefaultString(IMTJCoreConstants.PREF_PREVERIFY_CONFIG_VALUE); >- for (int i = 0; i < configSpecs.length; i++) { >- IAPI spec = configSpecs[i]; >- if (spec.toString().equals(config)) { >- specIndex = i; >- break; >- } >- } >+ configCombo.select(specIndex); >+ } > >- configCombo.select(specIndex); >- } >+ if (defaultPreverifierField != null) { >+ defaultPreverifierField.loadDefault(); >+ } >+ } > >- if (defaultPreverifierField != null) { >- defaultPreverifierField.loadDefault(); >- } >- } >+ /** >+ * Set the state of the controls based on the preferences. >+ */ >+ private void setControlsFromPreferences() { >+ if (preverificationRadios != null) { >+ IPreferenceStore store = getPreferenceStore(); >+ String location = store >+ .getString(IMTJCoreConstants.PREF_PREVERIFY_CONFIG_LOCATION); >+ for (int i = 0; i < preverificationRadios.length; i++) { >+ String fieldValue = CONFIG_FILE_LOCATIONS[i]; >+ preverificationRadios[i].setSelection(fieldValue >+ .equals(location)); >+ } > >- /** >- * Set the state of the controls based on the preferences. >- */ >- private void setControlsFromPreferences() { >- if (preverificationRadios != null) { >- IPreferenceStore store = getPreferenceStore(); >- String location = store >- .getString(IMTJCoreConstants.PREF_PREVERIFY_CONFIG_LOCATION); >- for (int i = 0; i < preverificationRadios.length; i++) { >- String fieldValue = CONFIG_FILE_LOCATIONS[i]; >- preverificationRadios[i].setSelection(fieldValue >- .equals(location)); >- } >+ IPreferenceStore preverifierTypestore = radioGroupFieldEditor >+ .getPreferenceStore(); >+ String asd = preverifierTypestore >+ .getString(IMTJCoreConstants.PREF_PREVERIFY_TYPE); >+ if (asd.equals("preverify_default")) { >+ defaultPreverifierField.setEnabled(true, >+ defaultPreverifierGroup); >+ } else { >+ defaultPreverifierField.setEnabled(false, >+ defaultPreverifierGroup); >+ } > >- int specIndex = 0; >- String config = store >- .getString(IMTJCoreConstants.PREF_PREVERIFY_CONFIG_VALUE); >- for (int i = 0; i < configSpecs.length; i++) { >- IAPI spec = configSpecs[i]; >- if (spec.toString().equals(config)) { >- specIndex = i; >- break; >- } >- } >+ int specIndex = 0; >+ String config = store >+ .getString(IMTJCoreConstants.PREF_PREVERIFY_CONFIG_VALUE); >+ for (int i = 0; i < configSpecs.length; i++) { >+ IAPI spec = configSpecs[i]; >+ if (spec.getIdentifier().equals(config)) { >+ specIndex = i; >+ break; >+ } >+ } > >- configCombo.select(specIndex); >- } >- if (defaultPreverifierField != null) { >- defaultPreverifierField.load(); >- } >- } >+ configCombo.select(specIndex); >+ } >+ if (defaultPreverifierField != null) { >+ defaultPreverifierField.load(); >+ } >+ } > >- private void setDefaultPreverifier() { >- // if the default preverifier value changed >- if (!defaultPreverifierField.getStringValue().equals( >- getPreferenceStore().getString( >- IMTJCoreConstants.PREF_DEFAULT_PREVERIFIER))) { >- File preverifierExecutable = new File(defaultPreverifierField >- .getStringValue()); >- IPreverifier preverifier = null; >- try { >- preverifier = MTJCore.createPreverifier( >- IPreverifier.PREVERIFIER_STANDARD, >- preverifierExecutable); >- } catch (CoreException e) { >- MTJUIPlugin >- .displayError( >- getShell(), >- IStatus.ERROR, >- -999, >- MTJUIMessages.PreverificationPreferencePage_invalid_preverifier_dialog_title, >- MTJUIMessages.PreverificationPreferencePage_invalid_preverifier_dialog_message, >- e); >- MTJLogger >- .log( >- IStatus.ERROR, >- NLS >- .bind( >- MTJUIMessages.PreverificationPreferencePage_device_store_error, >- new String[] { >- e.getClass().getName(), >- e.getMessage() }), e); >- } >- MTJCore.getDeviceRegistry().setDefaultPreverifer(preverifier); >+ private void setDefaultPreverifier() { >+ // if the default preverifier value changed >+ if (!defaultPreverifierField.getStringValue().equals( >+ getPreferenceStore().getString( >+ IMTJCoreConstants.PREF_DEFAULT_PREVERIFIER))) { >+ File preverifierExecutable = new File(defaultPreverifierField >+ .getStringValue()); >+ IPreverifier preverifier = null; >+ try { >+ preverifier = MTJCore.createPreverifier( >+ IPreverifier.PREVERIFIER_STANDARD, >+ preverifierExecutable); >+ } catch (CoreException e) { >+ MTJUIPlugin >+ .displayError( >+ getShell(), >+ IStatus.ERROR, >+ -999, >+ MTJUIMessages.PreverificationPreferencePage_invalid_preverifier_dialog_title, >+ MTJUIMessages.PreverificationPreferencePage_invalid_preverifier_dialog_message, >+ e); >+ MTJLogger >+ .log( >+ IStatus.ERROR, >+ NLS >+ .bind( >+ MTJUIMessages.PreverificationPreferencePage_device_store_error, >+ new String[] { >+ e.getClass().getName(), >+ e.getMessage() }), e); >+ } >+ MTJCore.getDeviceRegistry().setDefaultPreverifer(preverifier); > >- try { >- MTJCore.getDeviceRegistry().store(); >- } catch (Exception e) { >- MTJUIPlugin >- .displayError( >- getShell(), >- IStatus.ERROR, >- -999, >- MTJUIMessages.PreverificationPreferencePage_error_store_preverifier_dialog_title, >- MTJUIMessages.PreverificationPreferencePage_error_store_preverifier_dialog_message, >- e); >- MTJLogger >- .log( >- IStatus.ERROR, >- NLS >- .bind( >- MTJUIMessages.PreverificationPreferencePage_device_store_error, >- new String[] { >- e.getClass().getName(), >- e.getMessage() }), e); >- } >- } >+ try { >+ MTJCore.getDeviceRegistry().store(); >+ } catch (Exception e) { >+ MTJUIPlugin >+ .displayError( >+ getShell(), >+ IStatus.ERROR, >+ -999, >+ MTJUIMessages.PreverificationPreferencePage_error_store_preverifier_dialog_title, >+ MTJUIMessages.PreverificationPreferencePage_error_store_preverifier_dialog_message, >+ e); >+ MTJLogger >+ .log( >+ IStatus.ERROR, >+ NLS >+ .bind( >+ MTJUIMessages.PreverificationPreferencePage_device_store_error, >+ new String[] { >+ e.getClass().getName(), >+ e.getMessage() }), e); >+ } >+ } > >- } >+ } > >- /** >- * Set the state of the preferences based on the controls. >- */ >- private void setPreferencesFromControls() { >- IPreferenceStore store = getPreferenceStore(); >- for (int i = 0; i < preverificationRadios.length; i++) { >- if (preverificationRadios[i].getSelection()) { >- store.setValue( >- IMTJCoreConstants.PREF_PREVERIFY_CONFIG_LOCATION, >- CONFIG_FILE_LOCATIONS[i]); >- break; >- } >- } >+ /** >+ * Set the state of the preferences based on the controls. >+ */ >+ private void setPreferencesFromControls() { >+ IPreferenceStore store = getPreferenceStore(); >+ for (int i = 0; i < preverificationRadios.length; i++) { >+ if (preverificationRadios[i].getSelection()) { >+ store.setValue( >+ IMTJCoreConstants.PREF_PREVERIFY_CONFIG_LOCATION, >+ CONFIG_FILE_LOCATIONS[i]); >+ break; >+ } >+ } > >- int index = configCombo.getSelectionIndex(); >- store.setValue(IMTJCoreConstants.PREF_PREVERIFY_CONFIG_VALUE, >- configSpecs[index].toString()); >- if (defaultPreverifierField != null) { >- setDefaultPreverifier(); >- defaultPreverifierField.store(); >- } >- } >+ int index = configCombo.getSelectionIndex(); >+ store.setValue(IMTJCoreConstants.PREF_PREVERIFY_CONFIG_VALUE, >+ configSpecs[index].getIdentifier()); >+ if (defaultPreverifierField != null) { >+ setDefaultPreverifier(); >+ defaultPreverifierField.store(); >+ } >+ } > >- /** >- * Return a boolean indicating if the specified project is using >- * project-specific preverification settings. >- * >- * @param project >- * @return >- */ >- private boolean usesProjectSpecificPreverification(IProject project) { >- ProjectScope projectScope = new ProjectScope(project); >- IEclipsePreferences prefNode = projectScope >- .getNode(IMTJCoreConstants.PLUGIN_ID); >+ /** >+ * Return a boolean indicating if the specified project is using >+ * project-specific preverification settings. >+ * >+ * @param project >+ * @return >+ */ >+ private boolean usesProjectSpecificPreverification(IProject project) { >+ ProjectScope projectScope = new ProjectScope(project); >+ IEclipsePreferences prefNode = projectScope >+ .getNode(IMTJCoreConstants.PLUGIN_ID); > >- return prefNode.getBoolean( >- IMTJCoreConstants.PREF_PREVERIFY_USE_PROJECT, false); >- } >+ return prefNode.getBoolean( >+ IMTJCoreConstants.PREF_PREVERIFY_USE_PROJECT, false); >+ } > >- /* (non-Javadoc) >- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) >- */ >- @Override >- protected Control createContents(Composite parent) { >+ /** >+ * Add the controls that are for work-in-progress function. >+ * >+ * @param composite >+ */ >+ private void addTypeOfPreverifier(final Composite composite) { >+ radioGroupFieldEditor = new RadioGroupFieldEditor( >+ IMTJCoreConstants.PREF_PREVERIFY_TYPE, >+ "Preverifier to use", >+ 1, >+ new String[][] { >+ { "Default Preverifier", >+ IMTJCoreConstants.PREF_DEFAULT_PREVERIFIER }, >+ { "Emulator Preverifier", >+ IMTJCoreConstants.PREF_PREVERIFY_TYPE_EMULATOR }, >+ { "Proguard Preverifier", >+ IMTJCoreConstants.PREF_PREVERIFY_TYPE_PROGUARD } }, >+ composite, true); >+ radioGroupFieldEditor.setPreferenceStore(getPreferenceStore()); >+ radioGroupFieldEditor.load(); >+ radioGroupFieldEditor.fillIntoGrid(composite, 1); > >- Composite composite = new Composite(parent, SWT.NONE); >- composite.setLayout(new GridLayout(1, false)); >- composite.setLayoutData(new GridData(GridData.FILL_BOTH)); >+ radioGroupFieldEditor >+ .setPropertyChangeListener(new IPropertyChangeListener() { >+ public void propertyChange(PropertyChangeEvent event) { >+ String newValue = (String) event.getNewValue(); >+ if (!newValue.equals(event.getOldValue())) { >+ if (newValue.equals("default_preverifier")) { >+ defaultPreverifierField.setEnabled(true, >+ defaultPreverifierGroup); >+ } else if (newValue.equals("preverify_proguard") >+ || newValue.equals("preverify_emulator")) { >+ defaultPreverifierField.setEnabled(false, >+ defaultPreverifierGroup); >+ } >+ } >+ } >+ }); > >- addConfigurationControls(composite); >+ // * "GeneralPage.DoubleClick", resName, 1, >+ // * new String[][] { >+ // * {"Open Browser", "open"}, >+ // * {"Expand Tree", "expand"} >+ // * }, >+ // * parent > >- if (!embeddedInProperties) { >- addDefaultPreverifierControls(composite); >- } else { >- noDefaultAndApplyButton(); >- } >+ addField(radioGroupFieldEditor); >+ } > >- setControlsFromPreferences(); >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse >+ * .swt.widgets.Composite) >+ */ >+ @Override >+ protected Control createContents(Composite parent) { > >- return composite; >- } >+ Composite composite = new Composite(parent, SWT.NONE); >+ composite.setLayout(new GridLayout(1, false)); >+ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); >+ >+ addConfigurationControls(composite); >+ >+ addTypeOfPreverifier(composite); >+ >+ if (!embeddedInProperties) { >+ addDefaultPreverifierControls(composite); >+ } else { >+ noDefaultAndApplyButton(); >+ } >+ >+ setControlsFromPreferences(); >+ >+ return composite; >+ } >+ >+ private String getPreverifierType() { >+ return PreferenceAccessor.instance.getPreverifierType(getProject()); >+ >+ } >+ >+ public IProject getProject() { >+ return javaProject.getProject(); >+ } >+ >+ @Override >+ protected void createFieldEditors() { >+ // TODO Auto-generated method stub >+ >+ } > }
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
Flags:
wgp010
:
review-
Actions:
View
|
Diff
Attachments on
bug 234139
:
102140
|
133924
|
135358
|
135639
|
141448
|
142704