Note that there are some explanatory texts on larger screens.

plurals
  1. POCyclic dependency of two eclipse projects
    text
    copied!<p>I am trying to implement some sort of MVC in Java. Actually it's more of a MVP but this doesn't really matter to my problem.</p> <p>Following situation: I've got a GUI, made with Netbeans (because of the better GUIeditor) which is updated and changed frequently.</p> <p>As my main project is easier to maintain in Eclipse I chose to import the Netbeans project into Eclipse as a separate project. So here I am with a project "<code>App</code>" containing the controller and the model package and a project "<code>GUI</code>" containing the view package. The problem is that the pattern I am following along has a cyclic dependecy between the view and the controller. Whenever the view changes, the controller gets notified decides which data to get from the model and then makes the changes to the view.</p> <p>When I add <code>App</code> to the build path of <code>GUI</code> and the other way round, I will end up with this error message "A cycle was detected in the build path of project 'GUI'". <em>I mean that's true, this cycle is already in my design.</em> </p> <p>Currently at startup I register a view to its controller in the following way (this is no real code, I am trying to shorten it)</p> <pre><code>package view; import controller.*; class viewA{ ... public viewA() { controllerA.register(this); } ... } package controller; import view.*; class controllerA implements SomeListener{ ... protected viewA[] registeredViews; public static register(viewA interestedView){ arrayPush(registeredViews,interestedView); interestedView.addSomeListener(this) } ... } </code></pre> <p>So you see the connection is made by passing a reference to the controller and then registering a listener onto this view. The problem is: if I don't have the <code>GUI</code> project in <code>App</code>'s buildpath the import can't be resolved, same happens for not having <code>App</code> in <code>GUI</code>'s build path.</p> <p>I'd like to keep this project structure and also stick to my MVC architecture. How can I work around it? What are your suggestions?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload