我一直在处理一个Processing项目,现在想把它移植到Eclipse中。我已经用Eclipse环境安装了Proclipse。
I've been working on a Processing project for a while, and now want to move it into Eclipse. I've installed Proclipse with my Eclipse environment.
我有很多扩展名为.pde的文件。但是Proclipse文件全部以.java结尾。并且所有pde文件都有很多依赖问题。如何转换我的项目?
I've a lot of files with the extension of ".pde". However the Proclipse files all ends with ".java". And there's a lot of dependency issues with all the pde files. How should I convert my project?
===============
===============
谢谢大家!似乎没有一个按钮的解决方案,我按照乔治的答案类似的方式重构了所有的代码。加上将所有文件扩展名从.pde更改为.java。
Thanks everyone! There doesn't seem to be a one-button solution, I refactored all the code following an approach similar to George's answer. Plus changing all the file extensions from ".pde" to ".java".
推荐答案何塞的建议是相当不错的。 快照已经使创建处理项目变得容易。
Jose's advice is pretty good. Proclipsing already makes creating a Processing project easy.
在eclipse中运行的最简单(但不是最简单的方法)将采取以下步骤:
The easiest (but not cleanest way to get your Processing code running in eclipse would be taking these steps:
更新 这里使用Processing的导出应用程序功能稍微简单一些。 我将使用来自示例>主题>模拟>植根的Daniel Shiffman的Boids示例来解释此工作流程,因为它有多个选项卡和类。
Update Here is a slightly simpler approach using Processing's Export Application feature. I will explain this workflow using the Daniel Shiffman's Boids example from Examples > Topics > Simulate > Flocking since it has multiple tabs and classes.
此时希望大部分错误都应该已经消失了。现在尝试运行代码作为Java应用程序。
At this point hopefully most of the errors should have disappeared. Try to run your code as a Java Application now.
问题是在这一点上,您有一个庞大的类仍然很难维护,这可能是您的原因在日食中排名第一。现在将是重构(重组你的代码)的时候,幸运的是eclipse有一些很棒的工具。 如果你看到重复的代码,这是一个很好的候选人的功能。您可以尝试选择该代码,右键单击,然后选择 Refactor>提取方法。重复代码中更改的值可以作为参数/参数提取。
The problem is at this point you have one massive class which is still hard to maintain, probably the reason you're moving to eclipse in the 1st place. Now would be the time to refactor(restructure your code) and luckily eclipse has some great tools for that. If you see repetitive code, that's a great candidate for a function. You can try selecting that code , right clicking then choosing Refactor > Extract Method. The values that change in the repeated code can be extracted as arguments/parameters.
内部类应该移动到新的.java文件,如果您在这些类中使用处理特定的功能,您有多个选项:
Inner classes should move to new .java files and if you use Processing specific functionalities in those classes you've got multiple options:
最重要的是,你应该熟悉一下Java(从头开始编写一个HelloWorld程序)在处理的内部类),特别是一些OOP概念(组合,继承和可能的几个基本设计模式(如Visitor或MVC)在未来。当然,如果你刚刚开始使用这些概念:)
Most importantly though you should familiarize yourself a little bit with Java (compiling a HelloWorld program from scratch which will shine a light on Processing's inner classes) and especially some OOP concepts(composition, inheritance and perhaps a few basic design patterns (such as Visitor or MVC) in the future. This of course, if you're new to these concepts :)
更新这里的href =lifesine.eu/so/p5_to_eclipse.mp4 =nofollow>视频。前两分钟说明了基本过程,其余包括上述一些重构概念。
Update the simplified updated instructions for Proclipsing are now available as a video here. The first two minutes illustrate the basic process and the rest covers some of the refactoring concepts mentioned above.
更多推荐
将处理项目移植到Eclipse中
发布评论