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 105776 Details for
Bug 237292
[fiximprove] Configure jar/jad names in create package
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
new version of the patch for the bug
ConfigurejarjadNamePatch(v2).txt (text/plain), 17.13 KB, created by
Gang(Allen) Ma
on 2008-06-24 22:54:58 EDT
(
hide
)
Description:
new version of the patch for the bug
Filename:
MIME Type:
Creator:
Gang(Allen) Ma
Created:
2008-06-24 22:54:58 EDT
Size:
17.13 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mtj.ui >Index: src/org/eclipse/mtj/ui/MTJUIPluginResources.properties >=================================================================== >--- src/org/eclipse/mtj/ui/MTJUIPluginResources.properties (revision 239) >+++ src/org/eclipse/mtj/ui/MTJUIPluginResources.properties (working copy) >@@ -152,6 +152,10 @@ > J2MEProjectPropertiesPage.FilterNameKeystores=Keystores (*.ks) > J2MEProjectPropertiesPage.FilterNameAllFiles=All Files (*.*) > >+J2MEProjectPropertiesPage.JarFileName=JAR file name: >+J2MEProjectPropertiesPage.JADFileName=JAD file name: >+ >+ > #################################################################### > # > # This section of the file contains error messages. >Index: src/org/eclipse/mtj/ui/internal/properties/J2MESigningPropertiesPage.java >=================================================================== >--- src/org/eclipse/mtj/ui/internal/properties/J2MESigningPropertiesPage.java (revision 239) >+++ src/org/eclipse/mtj/ui/internal/properties/J2MESigningPropertiesPage.java (working copy) >@@ -11,6 +11,8 @@ > * Kevin Hunter (Individual) - Added signature support > * Diego Sandin (Motorola) - Refactoring package name to follow eclipse > * standards >+ * Gang Ma (Sybase) - Change page validation to follow eclipse >+ * UI guide > */ > package org.eclipse.mtj.ui.internal.properties; > >@@ -74,7 +76,7 @@ > */ > public class J2MESigningPropertiesPage extends PropertyPage implements > IWorkbenchPropertyPage { >- private CLabel errorLabel; // label into which error messages are placed >+ //private CLabel errorLabel; // label into which error messages are placed > > private Button signProjectCheckButton; // "Sign project?" checkbox > >@@ -195,12 +197,12 @@ > Composite composite = new Composite(parent, SWT.NONE); > composite.setLayout(new GridLayout(1, true)); > >- errorLabel = new CLabel(composite, SWT.LEFT); >- errorLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >- FontData[] fd = errorLabel.getFont().getFontData(); >- Font f = new Font(parent.getDisplay(), fd[0].getName(), fd[0] >- .getHeight(), SWT.BOLD); >- errorLabel.setFont(f); >+// errorLabel = new CLabel(composite, SWT.LEFT); >+// errorLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+// FontData[] fd = errorLabel.getFont().getFontData(); >+// Font f = new Font(parent.getDisplay(), fd[0].getName(), fd[0] >+// .getHeight(), SWT.BOLD); >+// errorLabel.setFont(f); > > Group signingGroup = new Group(composite, SWT.NONE); > signingGroup.setText(SIGNING_GROUP_TEXT); >@@ -570,7 +572,7 @@ > keyPassLabel.setEnabled(false); > keyPassText.setEnabled(false); > sigProps.clear(); >- errorLabel.setText(""); //$NON-NLS-1$ >+// errorLabel.setText(""); //$NON-NLS-1$ > testButton.setEnabled(false); > return (true); > } >@@ -596,7 +598,8 @@ > > String value = convertEmptyToNull(aliasText.getText()); > if (value == null) { >- errorLabel.setText(ERROR_MISSING_ALIAS); >+// errorLabel.setText(ERROR_MISSING_ALIAS); >+ setErrorMessage(ERROR_MISSING_ALIAS); > return (false); > } > >@@ -608,7 +611,8 @@ > > value = convertEmptyToNull(keystorePassText.getText()); > if (value == null) { >- errorLabel.setText(ERROR_MISSING_STOREPASS); >+// errorLabel.setText(ERROR_MISSING_STOREPASS); >+ setErrorMessage(ERROR_MISSING_STOREPASS); > return (false); > } > sigProps.setKeyStorePassword(value); >@@ -615,7 +619,8 @@ > > value = convertEmptyToNull(keyPassText.getText()); > if (value == null) { >- errorLabel.setText(ERROR_MISSING_KEYPASS); >+// errorLabel.setText(ERROR_MISSING_KEYPASS); >+ setErrorMessage(ERROR_MISSING_KEYPASS); > return (false); > } > sigProps.setKeyPassword(value); >@@ -625,7 +630,8 @@ > > value = convertEmptyToNull(keystorePassText.getText()); > if (value == null) { >- errorLabel.setText(ERROR_MISSING_STOREPASS); >+// errorLabel.setText(ERROR_MISSING_STOREPASS); >+ setErrorMessage(ERROR_MISSING_STOREPASS); > return (false); > } > sigProps.setKeyStorePassword(value); >@@ -632,7 +638,8 @@ > > value = convertEmptyToNull(keyPassText.getText()); > if (value == null) { >- errorLabel.setText(ERROR_MISSING_KEYPASS); >+// errorLabel.setText(ERROR_MISSING_KEYPASS); >+ setErrorMessage(ERROR_MISSING_KEYPASS); > return (false); > } > sigProps.setKeyPassword(value); >@@ -648,7 +655,8 @@ > sigProps > .setKeyStoreType(convertEmptyToNull(keystoreTypeText.getText())); > >- errorLabel.setText(""); //$NON-NLS-1$ >+// errorLabel.setText(""); //$NON-NLS-1$ >+ setErrorMessage(null); > testButton.setEnabled(true); > return (true); > } >@@ -663,7 +671,8 @@ > > value = convertEmptyToNull(keyfilePath.getText()); > if (value == null) { >- errorLabel.setText(ERROR_MISSING_KEYSTORE); >+// errorLabel.setText(ERROR_MISSING_KEYSTORE); >+ setErrorMessage(ERROR_MISSING_KEYSTORE); > return (false); > } > >@@ -678,7 +687,8 @@ > > File f = new File(value); > if (!f.exists()) { >- errorLabel.setText(ERROR_NOSUCH_KEYSTORE); >+// errorLabel.setText(ERROR_NOSUCH_KEYSTORE); >+ setErrorMessage(ERROR_NOSUCH_KEYSTORE); > return (false); > } > >@@ -683,7 +693,8 @@ > } > > if (!f.isFile()) { >- errorLabel.setText(ERROR_INVALID_KEYSTORE); >+// errorLabel.setText(ERROR_INVALID_KEYSTORE); >+ setErrorMessage(ERROR_INVALID_KEYSTORE); > return (false); > } > >Index: src/org/eclipse/mtj/ui/internal/properties/J2MEProjectPropertiesPage.java >=================================================================== >--- src/org/eclipse/mtj/ui/internal/properties/J2MEProjectPropertiesPage.java (revision 239) >+++ src/org/eclipse/mtj/ui/internal/properties/J2MEProjectPropertiesPage.java (working copy) >@@ -12,9 +12,11 @@ > * Diego Sandin (Motorola) - Refactoring package name to follow eclipse > * standards > * Hugo Raniere (Motorola) - Removing Preprocessor code >+ * Gang Ma (Sybase) - Add jar/jad names configuration support > */ > package org.eclipse.mtj.ui.internal.properties; > >+import java.io.IOException; > import java.io.Serializable; > import java.lang.reflect.InvocationTargetException; > import java.util.Arrays; >@@ -21,7 +23,10 @@ > import java.util.Comparator; > > import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.IWorkspace; > import org.eclipse.core.resources.IncrementalProjectBuilder; >+import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.core.runtime.IProgressMonitor; >@@ -26,6 +31,7 @@ > import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Path; > import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jdt.core.JavaCore; > import org.eclipse.jface.dialogs.ProgressMonitorDialog; >@@ -33,13 +39,15 @@ > import org.eclipse.jface.viewers.ComboViewer; > import org.eclipse.jface.viewers.ISelectionChangedListener; > import org.eclipse.jface.viewers.IStructuredContentProvider; >-import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.viewers.LabelProvider; > import org.eclipse.jface.viewers.SelectionChangedEvent; >-import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.jface.viewers.Viewer; > import org.eclipse.mtj.core.IMTJCoreConstants; > import org.eclipse.mtj.core.internal.MTJCorePlugin; >+import org.eclipse.mtj.core.internal.preverification.builder.PreverificationBuilder; >+import org.eclipse.mtj.core.internal.utils.ColonDelimitedProperties; >+import org.eclipse.mtj.core.model.ApplicationDescriptor; >+import org.eclipse.mtj.core.model.IJADConstants; > import org.eclipse.mtj.core.model.IMidletSuiteProject; > import org.eclipse.mtj.core.model.MidletSuiteFactory; > import org.eclipse.mtj.core.model.SymbolDefinitionSet; >@@ -51,6 +59,8 @@ > import org.eclipse.mtj.ui.MTJUIStrings; > import org.eclipse.mtj.ui.devices.DeviceSelector; > import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.ModifyEvent; >+import org.eclipse.swt.events.ModifyListener; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Composite; >@@ -55,8 +65,8 @@ > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; >-import org.eclipse.swt.widgets.Display; > import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Text; > import org.eclipse.ui.IWorkbenchPropertyPage; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.dialogs.PropertyPage; >@@ -70,7 +80,7 @@ > */ > public class J2MEProjectPropertiesPage extends PropertyPage implements > IWorkbenchPropertyPage { >- >+ > private static final Object[] NO_ELEMENTS = new Object[0]; > > // Comparator for definition sets based on name >@@ -128,6 +138,12 @@ > > private DeviceSelector deviceSelector; > private ComboViewer symbolDefinitionSetViewer; >+ >+ private Text jadFileNameText; >+ private Text jarFileNameText; >+ >+ >+ private boolean fileNameValid = true; //valid the jad file name and jar file name > > /** > * Returns <code>true</code> if the page data is currently valid. >@@ -135,7 +151,7 @@ > * @see org.eclipse.jface.preference.IPreferencePage#isValid() > */ > public boolean isValid() { >- return deviceSelector.getSelectedDevice() != null; >+ return deviceSelector.getSelectedDevice() != null && fileNameValid; > } > > /** >@@ -155,7 +171,8 @@ > try { > final IDevice device = deviceSelector.getSelectedDevice(); > final IMidletSuiteProject midletProject = getMidletSuiteProject(); >- >+ final String newJadFileName = jadFileNameText.getText(); >+ final String newJarFileName = jarFileNameText.getText(); > dialog.run(true, false, new IRunnableWithProgress() { > public void run(IProgressMonitor monitor) > throws InvocationTargetException, >@@ -162,7 +179,40 @@ > InterruptedException { > try { > midletProject.setDevice(device, monitor); >+ boolean needCleanProject = false; >+ // the jad file name has been changed >+ if(!midletProject.getJadFile().getName().equalsIgnoreCase(newJadFileName)){ >+ Path newPath = new Path(newJadFileName); >+ //copy the source to the new file,and delete it >+ midletProject.getJadFile().copy(newPath, true, monitor); >+ midletProject.getJadFile().delete(true, monitor); >+ //must set the new jad file's location >+ midletProject >+ .setJadFileLocation(midletProject >+ .getJadFile().getProjectRelativePath() >+ .removeLastSegments(1) >+ .append(newJadFileName)); >+ >+ } >+ // the jar file name has been changed >+ if(!midletProject.getJarFilename().equalsIgnoreCase(newJarFileName)){ >+ ApplicationDescriptor appDescriptor = midletProject.getApplicationDescriptor(); >+ ColonDelimitedProperties jadProperties = appDescriptor.getManifestProperties(); >+ // Update the jar file URL >+ jadProperties.setProperty(IJADConstants.JAD_MIDLET_JAR_URL, newJarFileName); >+ >+ try { >+ appDescriptor.store(); >+ } catch (IOException e) { >+ // TODO Auto-generated catch block >+ e.printStackTrace(); >+ } >+ needCleanProject = true; >+ } > midletProject.saveMetaData(); >+ // need to clean the project >+ if(needCleanProject) >+ PreverificationBuilder.cleanProject(midletProject.getProject(), true, monitor); > midletProject.getProject().build( > IncrementalProjectBuilder.FULL_BUILD, > monitor); >@@ -227,7 +277,7 @@ > if (isJ2MEProject(project)) { > Composite composite = new Composite(parent, SWT.NONE); > composite.setLayout(new GridLayout(1, true)); >- >+ > // Create the device selector > deviceSelector = new DeviceSelector(); > deviceSelector.createContents(composite, true); >@@ -250,7 +300,8 @@ > > //FIXME Preprocessor is not yet available > // addSymbolSelector(composite); >- >+ //add jad/jar file name configuration control >+ addJadJarConfigure(composite); > control = composite; > > } else { >@@ -306,6 +357,37 @@ > // } > // } > >+ /** >+ * add jad/jar filename configuration control to the page >+ */ >+ private void addJadJarConfigure(Composite parent){ >+ Composite composite = new Composite(parent, SWT.NONE); >+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ composite.setLayout(new GridLayout(2, false)); >+ >+ IMidletSuiteProject midletProject = getMidletSuiteProject(); >+ >+ new Label(composite, SWT.NONE).setText(MTJUIStrings.getString("J2MEProjectPropertiesPage.JADFileName")); >+ jadFileNameText = new Text(composite, SWT.BORDER); >+ jadFileNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ jadFileNameText.setText(midletProject.getJadFile().getName()); >+ jadFileNameText.addModifyListener(new ModifyListener() { >+ public void modifyText(ModifyEvent e) { >+ validatePage(); >+ } >+ }); >+ >+ new Label(composite, SWT.NONE).setText(MTJUIStrings.getString("J2MEProjectPropertiesPage.JarFileName")); >+ jarFileNameText = new Text(composite, SWT.BORDER); >+ jarFileNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ jarFileNameText.setText(midletProject.getJarFilename()); >+ jarFileNameText.addModifyListener(new ModifyListener() { >+ public void modifyText(ModifyEvent e) { >+ validatePage(); >+ } >+ }); >+ >+ } > /** > * Get the midlet suite project for this project. > * >@@ -421,4 +503,38 @@ > > return readOnly; > } >+ /** >+ * check whether the page is valid >+ */ >+ private void validatePage() { >+ String message = null; >+ >+ IWorkspace workspace = ResourcesPlugin.getWorkspace(); >+ IStatus result; >+ String jadFileName = jadFileNameText.getText(); >+ result = workspace.validateName(jadFileName, IResource.FILE); >+ if (!result.isOK()) { >+ message = result.getMessage(); >+ } else if (!jadFileName.endsWith(".jad")) { >+ message = "JAD file name must end with .jad"; >+ } >+ >+ String jarFileName = jarFileNameText.getText(); >+ result = workspace.validateName(jarFileName, IResource.FILE); >+ if (!result.isOK()){ >+ message = result.getMessage();; >+ }else if (!jarFileName.endsWith(".jar")){ >+ message = "Jar file name must end with .jar"; >+ } >+ >+ setErrorMessage(message); >+ if (message != null) { >+ fileNameValid = false; >+ }else{ >+ fileNameValid = true; >+ } >+ updateApplyButton(); >+ getContainer().updateButtons(); >+ } >+ > } >#P org.eclipse.mtj.docs >Index: docs/refPropProject.html >=================================================================== >--- docs/refPropProject.html (revision 239) >+++ docs/refPropProject.html (working copy) >@@ -54,6 +54,13 @@ > </p> > </td> > </tr> >+<tr> >+<td>JAD/JAR file name</td> >+<td> >+The default JAD/JAR file names are based on the project name, if you want >+to configure them to your own names, you can set them here. >+</td> >+</tr> > </table> > <h1 id="signing">MIDlet Suite Signing page</h1> > <p>
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:
wds057
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 237292
:
105610
| 105776 |
105777