From: <aki...@us...> - 2008-08-01 22:00:06
|
Revision: 4668 http://gridarta.svn.sourceforge.net/gridarta/?rev=4668&view=rev Author: akirschbaum Date: 2008-08-01 22:00:10 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Remove calls to AbstractMainControl.getInstance(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-08-01 21:46:37 UTC (rev 4667) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-08-01 22:00:10 UTC (rev 4668) @@ -248,8 +248,8 @@ /** {@inheritDoc} */ @Override - public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl) { - scriptArchData.modifyEventScript(eventType, task, eventList, mainControl); + public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent) { + scriptArchData.modifyEventScript(eventType, task, eventList, mainControl, parent); if (scriptArchData.isEmpty()) { mapanel.setScriptPanelButtonState(true, false, false, false); Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java 2008-08-01 21:46:37 UTC (rev 4667) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java 2008-08-01 22:00:10 UTC (rev 4668) @@ -21,6 +21,7 @@ import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; +import java.awt.Frame; import java.util.Iterator; import java.util.Vector; import javax.swing.JDialog; @@ -118,8 +119,9 @@ * @param panelList JList from the MapArchPanel (script tab) which displays * the events * @param mainControl the main control instance + * @param parent the parent frame for dialog boxes */ - public void modifyEventScript(int eventIndex, final int task, @NotNull final JList panelList, @NotNull final MainControl<?, ?, ?, ?> mainControl) { + public void modifyEventScript(int eventIndex, final int task, @NotNull final JList panelList, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent) { GameObject oldEvent = null; /* Find the event object */ @@ -140,7 +142,7 @@ if (task == GameObjectAttributesPanel.SCRIPT_OPEN) { ScriptedEventEditor.openScript(mainControl, event.getScriptPath()); } else if (task == GameObjectAttributesPanel.SCRIPT_EDIT_PATH) { - ScriptedEventEditor.editParameters(event); + ScriptedEventEditor.editParameters(event, parent); } else if (task == GameObjectAttributesPanel.SCRIPT_REMOVE) { // first ask for confirmation if (JOptionPane.showConfirmDialog(panelList, "Are you sure you want to remove this \"" + ScriptArchUtils.typeName(event.getEventType()) + "\" event which is\n" + "linked to the script: '" + event.getScriptPath() + "'?\n" + "(The script file itself is not going to be deleted)", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) { Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-08-01 21:46:37 UTC (rev 4667) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-08-01 22:00:10 UTC (rev 4668) @@ -393,8 +393,8 @@ /** {@inheritDoc} */ @Override - public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl) { - scriptArchData.modifyEventScript(eventType, task, eventList, mainControl); + public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent) { + scriptArchData.modifyEventScript(eventType, task, eventList, mainControl, parent); if (scriptArchData.isEmpty()) { mapanel.setScriptPanelButtonState(true, false, false, false); Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java 2008-08-01 21:46:37 UTC (rev 4667) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java 2008-08-01 22:00:10 UTC (rev 4668) @@ -21,6 +21,7 @@ import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; +import java.awt.Frame; import java.util.Iterator; import java.util.Vector; import javax.swing.JDialog; @@ -117,8 +118,9 @@ * @param task ID number for task (open script/ edit path/ remove) * @param panelList JList from the MapArchPanel (script tab) which displays * the events + * @param parent the parent frame for dialog boxes */ - public void modifyEventScript(int eventIndex, final int task, @NotNull final JList panelList, @NotNull final MainControl<?, ?, ?, ?> mainControl) { + public void modifyEventScript(int eventIndex, final int task, @NotNull final JList panelList, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent) { GameObject oldEvent = null; /* Find the event object */ @@ -139,7 +141,7 @@ if (task == GameObjectAttributesPanel.SCRIPT_OPEN) { ScriptedEventEditor.openScript(mainControl, event.getScriptPath()); } else if (task == GameObjectAttributesPanel.SCRIPT_EDIT_PATH) { - ScriptedEventEditor.editParameters(event); + ScriptedEventEditor.editParameters(event, parent); } else if (task == GameObjectAttributesPanel.SCRIPT_REMOVE) { // first ask for confirmation if (JOptionPane.showConfirmDialog(panelList, "Are you sure you want to remove this \"" + ScriptArchUtils.typeName(event.getEventType()) + "\" event which is\n" + "linked to the script: '" + event.getScriptPath() + "'?\n" + "(The script file itself is not going to be deleted)", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) { Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-08-01 21:46:37 UTC (rev 4667) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-08-01 22:00:10 UTC (rev 4668) @@ -1380,9 +1380,10 @@ * the events * @param mapanel the MapArchPanel * @param mainControl the main control instance + * @param parent the parent frame for dialog boxes * @xxx this method knows things it should never know, it is evil! */ - public abstract void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<G, A, R, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl); + public abstract void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<G, A, R, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent); /** * A popup is opened and the user can create a new scripting event which Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java 2008-08-01 21:46:37 UTC (rev 4667) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java 2008-08-01 22:00:10 UTC (rev 4668) @@ -20,6 +20,7 @@ package net.sf.gridarta.gameobject.scripts; import java.awt.FlowLayout; +import java.awt.Frame; import java.io.File; import javax.swing.BorderFactory; import javax.swing.Box; @@ -112,11 +113,12 @@ * Edit path and plugin name for an event. A popup dialog is shown with * input text fields for file path and plugin name. * @param scriptedEvent the event + * @param parent the parent frame for dialog boxes */ - public static void editParameters(final ScriptedEvent<?> scriptedEvent) { + public static void editParameters(final ScriptedEvent<?> scriptedEvent, @NotNull final Frame parent) { if (pathFrame == null) { // initialize popup frame - pathFrame = new JDialog(AbstractMainControl.getInstance().getMainView(), "Edit Parameters", true); + pathFrame = new JDialog(parent, "Edit Parameters", true); pathFrame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); final JPanel mainPanel = new JPanel(); @@ -166,7 +168,7 @@ pathFrame.getContentPane().add(mainPanel); pathFrame.pack(); - pathFrame.setLocationRelativeTo(AbstractMainControl.getInstance().getMainView()); + pathFrame.setLocationRelativeTo(parent); pathFrame.setVisible(true); } else { // just set fields and show Modified: trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-08-01 21:46:37 UTC (rev 4667) +++ trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-08-01 22:00:10 UTC (rev 4668) @@ -638,7 +638,7 @@ final MapSquare<G, A, R> mapSquare = selectedGameObject.getMapSquare(); assert mapSquare != null; mapSquare.getMapModel().beginTransaction("Modify event script"); - selectedGameObject.getHead().modifyEventScript(index, task, eventList, this, mainControl); + selectedGameObject.getHead().modifyEventScript(index, task, eventList, this, mainControl, parent); mapSquare.getMapModel().endTransaction(); } } Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-01 21:46:37 UTC (rev 4667) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-01 22:00:10 UTC (rev 4668) @@ -808,7 +808,7 @@ } /** {@inheritDoc} */ - public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<TestGameObject, TestMapArchObject, TestArchetype, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl) { + public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<TestGameObject, TestMapArchObject, TestArchetype, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent) { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |