| Summary: | Improvements in the Android NDK support UI | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Carlos Alberto Souto Junior <mkhv73> | ||||||||||||||||
| Component: | Sequoyah | Assignee: | Project Inbox <android.sequoyah-inbox> | ||||||||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||||||||
| Severity: | normal | ||||||||||||||||||
| Priority: | P3 | CC: | cdtdoug, kpqb38, nkvg64, wmg040 | ||||||||||||||||
| Version: | unspecified | ||||||||||||||||||
| Target Milestone: | --- | ||||||||||||||||||
| Hardware: | Macintosh | ||||||||||||||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||||||||||||||
| Whiteboard: | |||||||||||||||||||
| Attachments: |
|
||||||||||||||||||
|
Description
Carlos Alberto Souto Junior
Created attachment 170573 [details]
Patch for the preferences page
Moved the preferences page fomr the Android plugin to the Sequoyah CDT plugin.
Created attachment 170575 [details]
Moved the native lib preference to a project property page
Comment on attachment 170575 [details] Moved the native lib preference to a project property page >Index: src/org/eclipse/sequoyah/android/cdt/internal/build/ui/NDKPropertyPage.java >=================================================================== >--- src/org/eclipse/sequoyah/android/cdt/internal/build/ui/NDKPropertyPage.java (revision 0) >+++ src/org/eclipse/sequoyah/android/cdt/internal/build/ui/NDKPropertyPage.java (revision 0) >@@ -0,0 +1,159 @@ >+/* >+ * @(#)NDKPropertyPage.java >+ >+package org.eclipse.sequoyah.android.cdt.internal.build.ui; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IProjectNature; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IAdaptable; >+import org.eclipse.core.runtime.QualifiedName; >+import org.eclipse.jdt.core.IJavaProject; >+import org.eclipse.sequoyah.android.cdt.build.core.INDKService; >+import org.eclipse.sequoyah.android.cdt.build.core.NDKUtils; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Text; >+import org.eclipse.ui.IWorkbenchPropertyPage; >+import org.eclipse.ui.dialogs.PropertyPage; >+ >+/** >+ * DESCRIPTION: >+ * This class represents the properties page for Android NDK. >+ * It gives the user the option to set gcc version, platform, >+ * source object and library paths. >+ * */ >+public class NDKPropertyPage extends PropertyPage implements IWorkbenchPropertyPage >+{ >+ >+ //UI fields >+ private Text libraryTxt; >+ >+ //selected project >+ private IProject project = null; >+ >+ @Override >+ protected Control createContents(Composite parent) >+ { >+ IProjectNature nature = null; >+ IAdaptable apt = getElement(); >+ //get selected project >+ if (apt instanceof IJavaProject) >+ { >+ IJavaProject resource = (IJavaProject) getElement(); >+ project = resource.getProject(); >+ >+ try >+ { >+ nature = project.getNature("org.eclipse.cdt.core.cnature"); >+ } >+ catch (CoreException e) >+ { >+ // TODO Auto-generated catch block >+ e.printStackTrace(); >+ } >+ } >+ >+ Composite main = new Composite(parent, SWT.FILL); >+ main.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); >+ main.setLayout(new GridLayout(1, false)); >+ >+ Composite auxComp = new Composite(main, SWT.FILL); >+ auxComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); >+ auxComp.setLayout(new GridLayout(6, true)); >+ >+ //platform fields >+ Label libraryLabel = new Label(auxComp, SWT.FILL); >+ libraryLabel.setText("Native Library Name"); >+ libraryTxt = new Text(auxComp, SWT.FILL | SWT.BORDER); >+ libraryTxt.setEditable(true); >+ libraryTxt.setText(getInitialValue(INDKService.libName)); >+ libraryTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); >+ if (nature == null) >+ { >+ libraryTxt.setEnabled(false); >+ } >+ else >+ { >+ libraryTxt.setEnabled(true); >+ } >+ >+ Label dummyLabel2 = new Label(auxComp, SWT.None); >+ dummyLabel2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 4, 1)); >+ >+ return main; >+ } >+ >+ /**initialize properties values >+ * >+ * @param propertyId >+ * @return >+ */ >+ private String getInitialValue(QualifiedName propertyId) >+ { >+ String returnValue = ""; >+ try >+ { >+ if (project.getPersistentProperty(propertyId) != null) >+ { >+ returnValue = project.getPersistentProperty(propertyId); >+ } >+ } >+ catch (CoreException e1) >+ { >+ returnValue = ""; >+ } >+ return returnValue; >+ } >+ >+ @Override >+ /**called when apply button is pressed >+ * >+ */ >+ public void performApply() >+ { >+ try >+ { >+ // Check if the value was changed and generate a new Android make file accordingly >+ if ((project.getPersistentProperty(INDKService.libName) == null) >+ || !project.getPersistentProperty(INDKService.libName).equals( >+ libraryTxt.getText().trim())) >+ { >+ project.setPersistentProperty(INDKService.libName, libraryTxt.getText().trim()); >+ // Generate a new makefile >+ NDKUtils.generateAndroidMakeFile(project, libraryTxt.getText().trim()); >+ } >+ } >+ catch (CoreException e1) >+ { >+ >+ } >+ } >+ >+ @Override >+ /**called when ok button is pressed >+ * >+ */ >+ public boolean performOk() >+ { >+ >+ performApply(); >+ >+ return super.performOk(); >+ } >+} > >Property changes on: src/org/eclipse/sequoyah/android/cdt/internal/build/ui/NDKPropertyPage.java >___________________________________________________________________ >Added: svn:mime-type > + text/plain > >Index: plugin.properties >=================================================================== >--- plugin.properties (revision 2142) >+++ plugin.properties (working copy) >@@ -1,2 +1,3 @@ > pluginName=Android Native Support UI > provider=Eclipse Sequoyah >+NDKPropertiesPages = Android NDK >Index: plugin.xml >=================================================================== >--- plugin.xml (revision 2142) >+++ plugin.xml (working copy) >@@ -37,5 +37,13 @@ > </action> > </objectContribution> > </extension> >+ <extension >+ point="org.eclipse.ui.propertyPages"> >+ <page >+ class="org.eclipse.sequoyah.android.cdt.internal.build.ui.NDKPropertyPage" >+ id="org.eclipse.sequoyah.android.cdt.build.ui.NDKPojectPropertyPage" >+ name="%NDKPropertiesPages"> >+ </page> >+ </extension> > > </plugin> >Index: META-INF/MANIFEST.MF >=================================================================== >--- META-INF/MANIFEST.MF (revision 2142) >+++ META-INF/MANIFEST.MF (working copy) >@@ -15,3 +15,6 @@ > org.eclipse.sequoyah.android.cdt.build.core;bundle-version="1.0.0" > Bundle-RequiredExecutionEnvironment: J2SE-1.5 > Bundle-ActivationPolicy: lazy >+Import-Package: org.eclipse.jdt.core >+Bundle-Localization: plugin >+ Created attachment 170581 [details]
NDK wizard page linking system preferences.
Comment on attachment 170575 [details] Moved the native lib preference to a project property page >Index: src/org/eclipse/sequoyah/android/cdt/internal/build/ui/NDKPropertyPage.java >=================================================================== >--- src/org/eclipse/sequoyah/android/cdt/internal/build/ui/NDKPropertyPage.java (revision 0) >+++ src/org/eclipse/sequoyah/android/cdt/internal/build/ui/NDKPropertyPage.java (revision 0) >@@ -0,0 +1,159 @@ >+package org.eclipse.sequoyah.android.cdt.internal.build.ui; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IProjectNature; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IAdaptable; >+import org.eclipse.core.runtime.QualifiedName; >+import org.eclipse.jdt.core.IJavaProject; >+import org.eclipse.sequoyah.android.cdt.build.core.INDKService; >+import org.eclipse.sequoyah.android.cdt.build.core.NDKUtils; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Text; >+import org.eclipse.ui.IWorkbenchPropertyPage; >+import org.eclipse.ui.dialogs.PropertyPage; >+ >+/** >+ * DESCRIPTION: >+ * This class represents the properties page for Android NDK. >+ * It gives the user the option to set gcc version, platform, >+ * source object and library paths. >+ * */ >+public class NDKPropertyPage extends PropertyPage implements IWorkbenchPropertyPage >+{ >+ >+ //UI fields >+ private Text libraryTxt; >+ >+ //selected project >+ private IProject project = null; >+ >+ @Override >+ protected Control createContents(Composite parent) >+ { >+ IProjectNature nature = null; >+ IAdaptable apt = getElement(); >+ //get selected project >+ if (apt instanceof IJavaProject) >+ { >+ IJavaProject resource = (IJavaProject) getElement(); >+ project = resource.getProject(); >+ >+ try >+ { >+ nature = project.getNature("org.eclipse.cdt.core.cnature"); >+ } >+ catch (CoreException e) >+ { >+ // TODO Auto-generated catch block >+ e.printStackTrace(); >+ } >+ } >+ >+ Composite main = new Composite(parent, SWT.FILL); >+ main.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); >+ main.setLayout(new GridLayout(1, false)); >+ >+ Composite auxComp = new Composite(main, SWT.FILL); >+ auxComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); >+ auxComp.setLayout(new GridLayout(6, true)); >+ >+ //platform fields >+ Label libraryLabel = new Label(auxComp, SWT.FILL); >+ libraryLabel.setText("Native Library Name"); >+ libraryTxt = new Text(auxComp, SWT.FILL | SWT.BORDER); >+ libraryTxt.setEditable(true); >+ libraryTxt.setText(getInitialValue(INDKService.libName)); >+ libraryTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); >+ if (nature == null) >+ { >+ libraryTxt.setEnabled(false); >+ } >+ else >+ { >+ libraryTxt.setEnabled(true); >+ } >+ >+ Label dummyLabel2 = new Label(auxComp, SWT.None); >+ dummyLabel2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 4, 1)); >+ >+ return main; >+ } >+ >+ /**initialize properties values >+ * >+ * @param propertyId >+ * @return >+ */ >+ private String getInitialValue(QualifiedName propertyId) >+ { >+ String returnValue = ""; >+ try >+ { >+ if (project.getPersistentProperty(propertyId) != null) >+ { >+ returnValue = project.getPersistentProperty(propertyId); >+ } >+ } >+ catch (CoreException e1) >+ { >+ returnValue = ""; >+ } >+ return returnValue; >+ } >+ >+ @Override >+ /**called when apply button is pressed >+ * >+ */ >+ public void performApply() >+ { >+ try >+ { >+ // Check if the value was changed and generate a new Android make file accordingly >+ if ((project.getPersistentProperty(INDKService.libName) == null) >+ || !project.getPersistentProperty(INDKService.libName).equals( >+ libraryTxt.getText().trim())) >+ { >+ project.setPersistentProperty(INDKService.libName, libraryTxt.getText().trim()); >+ // Generate a new makefile >+ NDKUtils.generateAndroidMakeFile(project, libraryTxt.getText().trim()); >+ } >+ } >+ catch (CoreException e1) >+ { >+ >+ } >+ } >+ >+ @Override >+ /**called when ok button is pressed >+ * >+ */ >+ public boolean performOk() >+ { >+ >+ performApply(); >+ >+ return super.performOk(); >+ } >+} > >Property changes on: src/org/eclipse/sequoyah/android/cdt/internal/build/ui/NDKPropertyPage.java >___________________________________________________________________ >Added: svn:mime-type > + text/plain > >Index: plugin.properties >=================================================================== >--- plugin.properties (revision 2142) >+++ plugin.properties (working copy) >@@ -1,2 +1,3 @@ > pluginName=Android Native Support UI > provider=Eclipse Sequoyah >+NDKPropertiesPages = Android NDK >Index: plugin.xml >=================================================================== >--- plugin.xml (revision 2142) >+++ plugin.xml (working copy) >@@ -37,5 +37,13 @@ > </action> > </objectContribution> > </extension> >+ <extension >+ point="org.eclipse.ui.propertyPages"> >+ <page >+ class="org.eclipse.sequoyah.android.cdt.internal.build.ui.NDKPropertyPage" >+ id="org.eclipse.sequoyah.android.cdt.build.ui.NDKPojectPropertyPage" >+ name="%NDKPropertiesPages"> >+ </page> >+ </extension> > > </plugin> >Index: META-INF/MANIFEST.MF >=================================================================== >--- META-INF/MANIFEST.MF (revision 2142) >+++ META-INF/MANIFEST.MF (working copy) >@@ -15,3 +15,6 @@ > org.eclipse.sequoyah.android.cdt.build.core;bundle-version="1.0.0" > Bundle-RequiredExecutionEnvironment: J2SE-1.5 > Bundle-ActivationPolicy: lazy >+Import-Package: org.eclipse.jdt.core >+Bundle-Localization: plugin >+ Created attachment 170582 [details]
Moved the native lib preference to a project property page
The content of attachment 170575 [details] has been deleted by Eclipse Webmaster <webmaster@eclipse.org> who provided the following reason: Poster request The token used to delete this attachment was generated at 2010-05-31 16:17:06 EDT. Created attachment 170676 [details]
Native support UIs Update
Created attachment 170778 [details]
Bugfixes For prefs. Pages
Created attachment 171630 [details]
Android NDK CDT support UI and features
adds quickfix, custom wizards and prefs. pages in the Sequoyah CDT Plugin
Moving the bug. Merged on trunk@2163. Build ID 1.0.0.N20100614-0335. |