I'm using Eclipse with the Codename One Plugin.
Now I am starting a second project.
I would like to setup one or more "fragment" projects to avoid code duplication between projects. For example if I'm having a utility class for string concatenation I'd like to have this in a Utilities fragment project which then would be referenced by my projects.
What is the recommended way of doing this with Codename One?
For Codename One that's a cn1lib unfortunately at this time the Eclipse plugin is the only one that doesn't support the creation of a cn1lib (although it allows using them just fine).
Since a cn1lib is just an Ant project you can just download an existing project and put in your own code instead of what's there.
Related
I'm new to this topic and couldn't find any guides concerning this. I'm wondering how the Today Extension files from a xcode project (originated from the CN1 iOS debug build sources) needs to be added to the actual CN1 project in order to get integrated properly.
We don't have builtin support for that and didn't really study it. We never had official support for Android widgets either.
Both can be used through native code though. E.g. in this case you can use ios.plistInject to add the necessary plist changes. The actual UI/code that implements them should be done in a native interface anyway.
Is it possible? I couldn't find anything concerning this in the documentation. When I try to refresh cn1libs (which I downloaded over the CN1 preferences) in my cn1lib project it is stated that it's not relevant for this kind of project, although I would like to write a utility library based on other cn1libs.
There is no official support for dependency hierarchies in cn1libs because we don't want to create a "dependency hell". However, the extension manager does allow you to declare dependencies and you can use other cn1libs.
If you have a cn1lib you need to use you can just add it to the build classpath of the cn1lib you are currently building. In NetBeans this can be done from the GUI but can be done in other IDE's via the netbeans properties file. You can then use the other cn1lib, just make sure to include both cn1libs in the user project or you will get a dynamic link error.
See this https://www.codenameone.com/blog/tip-nest-cn1libs-cross-dependencies.html
I've been trying to download the parse4j from Thiagolocatelli but they're missing version 1.5-SNAPSHOT which includes a third parameter for Parse.initialize(), but I can't download version 1.5-SNAPSHOT from github nor from Maven repository, people talk about version 1.5-SNAPSHOT but looking at the Maven repository: https://mvnrepository.com/artifact/com.github.thiagolocatelli/parse4j there is no version 1.5-SNAPSHOT. So is it possible to use parse4cn1 in non cn1 projects like Android Studio projects? Will library work?
It is possible to use parse4cn1 in a regular Java project as documented here. In fact, the parse4cn1 unit test application uses this approach successfully. As already mentioned by Shai, you'll have some dependencies on some CN1-specific functionality but that is available via the CN1 JavaSE port.
For Android, I'll recommend using the native Android Parse SDK directly. The API is slightly different from that of parse4cn1 but in most cases similar. Moreover, the SDK provides more functionality such as a local data store.
No.
The code uses ConnectionRequest and similar Codename One specific classes to implement parse support.
I have an eclipse codenameone project. I would like to execute this project on Eclipse using my own codenameone modified sources (codenameone sources project is in netbeans). How could I do that ?
As it is mentioned in this video, we should linked the project in the build path but it works only if we have a netbean project.
Better solution is to edit Codenameone source in Eclipse (but sources in github has structure of a Netbeans project).
Thanks!
Right now debugging with the Codename One sources is only supported on NetBeans because that is the platforms we use for our coding. It's harder to work with other IDE's and might not be worth your effort.
Someone posted a while back in the discussion forum about running this in Eclipse but I couldn't find the reference.
Generally if you want to build the native sources and debug from there just work based on the logic we have and adapt it to Eclipse (or any other IDE). Running a Codename One project has 2 major dependencies:
Codename One project - that's a regular Java project you can work with
JavaSEPort another regular project, this is the implementation of the Codename One code and includes the simulator.
Make sure to add the source trees of both these projects to the compile but not packaging phases and set the Simulator class as your main class.
If you are successful in doing this it would be really nice if you write about it for the developer guide wiki next to the NetBeans build and explain how this is done for future developers.
I recently read FIRST CLASS ECLIPSE SUPPORT which made me expect a cn1lib-wizard. But there still is none, right?
The gist of the article is that we will update the Eclipse plugin with the NetBeans & IntelliJ versions. With the trend of migrating towards common code across IDE's within our plugin (the new settings UI) this should be much easier and Eclipse should no longer be out of date with the other IDE's.
I'm not sure when we'll get around to do the library template, unlike the other features it requires some work since the Ant implementation on Eclipse is rather different. So it's hard to give a specific date.