Zitat:
I think the best way is to import not the magellan2-extensions-plugins project, but every plugin as its own java project. For example MemoryWatchPlugin or YourPlugin. Then you have to tell the plugin project where to find the Magellan sources, by going to the project properties -> Java Build Path -> Projects and adding the Magellan2 project there. When I have time, I will try to go through the process myself and describe it in more detail. For now, you should be fine with the plugin in the Magellan project itself.
I had tried both ways. First tried the whole addon package and then each addon individually. I receive the following error:
[javac] eclipseWorspace\Magellan Source Code\magellan2\src-client\magellan\client\swing\map\RegionShapeCellRenderer.java:1495: error: method loadElements in class RegionShapeCellRenderer.GeomRendererAdapter.ModePanel cannot be applied to given types;
[javac] loadElements(politicsMode ? factionColors : regionColors);
[javac] ^
[javac] required: Map<T,Color>
[javac] found: politicsMo[...]olors
[javac] reason: inference variable T has incompatible equality constraints StringID,String
[javac] where T is a type-variable:
[javac] T extends Object declared in method <T>loadElements(Map<T,Color>)
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 error
It appears the Build Path is setup correctly from what I can tell. I am running the "build.installer.xml" in eclipse for each individual plugin.
Zitat:
As a note: I strongly recommend to use git to manage and archive your own progress while developing. Maybe more on that later.
I used git a little before, but need to better familiarize myself with it when I have time.
Zitat:
For adding a listener you have to implement the magellan.client.event.SelectionListener interface
I started with using the teacher plugin as my template. I have been adding and deleting code to better understand. I have successfully created my GUI (JPanel) with some information on it to test. I somehow figured out how to send my JComboBox (Region) to the client fairly quickly to my surprise. It took me much, much longer to send the client Active Region to my JComboBox. I actually spent way too much time to get the "client" info. I think I pretty much found it by mistake!
Once I discovered that Magellan plugins calls init() which allows me to get the client I made progress. The teacher plugin base I am using didn't send client to the GUI so I was able to change that and then finally was able to send the active region to my JComboBox
I tried going off the getSelectionType() without success as it was always returning 0. I am not sure if this is the best way, but I ended up using the following code:
Code:
public void selectionChanged(SelectionEvent se) {
Region region = (Region) rBox.getSelectedItem();
if (!data.getActiveRegion().equals(region)) {
region = data.getActiveRegion();
rBox.setSelectedItem(region);
setActiveRegion(region);
}
}
Zitat:
* by selecting SelectionListener, for example in the editor and calling the Type Hierarchy by pressing F4 you can see all the classes that implement SelectionListener.
This was VERY VERY helpful
You have no idea how much easier this whole project has been with your guidance. It is making this process VERY enjoyable!
My profession is in Sales and Management and I just play with coding when I have time as I really enjoy it. I don't know any languages really. Just pieces and parts of languages from wanting to do a certain project (mostly to do with games
) I understand a descent amount on Java coding now as I never tried Java until this project, but proper layout(still want to do 1 long script instead of multiple classes, methods, etc.) I still have a long way to go.
I will do some more playing around, but I am actually very optimistic I will be able to get this to work. I may even dive into the UnitOrders side of it later to auto update on the fly