From: <aki...@us...> - 2008-08-21 21:28:29
|
Revision: 4964 http://gridarta.svn.sourceforge.net/gridarta/?rev=4964&view=rev Author: akirschbaum Date: 2008-08-21 21:28:37 +0000 (Thu, 21 Aug 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-21 21:19:46 UTC (rev 4963) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-21 21:28:37 UTC (rev 4964) @@ -166,11 +166,8 @@ * @throws RuntimeException If the controller cannot be initialized. */ public CMainControl(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { - super(gridartaObjectsFactory, new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(gridartaObjectsFactory), false, CResourceLoader.getHomeFile("thumbnails"), null, "DaimoninEditor.jar"); + super(gridartaObjectsFactory, new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(gridartaObjectsFactory), false, CResourceLoader.getHomeFile("thumbnails"), null, "DaimoninEditor.jar", pythonFileFilter, ".py"); - // initialize the script-editor pad - ScriptEditControlInstance.init(pythonFileFilter, ".py", mainView, new File(globalSettings.getMapDefaultFolder())); - // load the list with archtype-data from "types.xml" final XmlHelper xmlHelper; try { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-21 21:19:46 UTC (rev 4963) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-21 21:28:37 UTC (rev 4964) @@ -226,11 +226,8 @@ * @throws RuntimeException If the controller cannot be initialized. */ public CMainControl(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { - super(gridartaObjectsFactory, new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(gridartaObjectsFactory), true, null, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), "CrossfireEditor.jar"); + super(gridartaObjectsFactory, new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(gridartaObjectsFactory), true, null, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), "CrossfireEditor.jar", luaFileFilter, ".lua"); - // initialize the script-editor pad - ScriptEditControlInstance.init(luaFileFilter, ".lua", mainView, new File(globalSettings.getMapDefaultFolder())); - // load the list with archtype-data from "types.xml" final XmlHelper xmlHelper; try { Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-21 21:19:46 UTC (rev 4963) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-21 21:28:37 UTC (rev 4964) @@ -244,8 +244,10 @@ * @param compassIcon the icon to display in the selected square view; * <code>null</code> to not show an icon * @param gridartaJarFilename the filename of the editor's .jar file + * @param scriptFileFilter the file filter for script files + * @param scriptExtension the file extension for script files */ - protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, final boolean createDirectionPane, @Nullable final File mapImageCacheDir, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename) { + protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, final boolean createDirectionPane, @Nullable final File mapImageCacheDir, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension) { this.globalSettings = globalSettings; this.mapControlFactory = mapControlFactory; final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory, mapControlFactory, globalSettings); @@ -289,6 +291,7 @@ new UndoControl<G, A, R, V>(mapManager); updaterManager = new UpdaterManager(key, this, mapManager, mainView, gridartaJarFilename); updaterManager.startup(); + ScriptEditControlInstance.init(scriptFileFilter, scriptExtension, mainView, new File(globalSettings.getMapDefaultFolder())); } /** Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-21 21:19:46 UTC (rev 4963) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-21 21:28:37 UTC (rev 4964) @@ -33,6 +33,7 @@ import javax.swing.ImageIcon; import javax.swing.JList; import javax.swing.JPanel; +import javax.swing.filechooser.FileFilter; import net.sf.gridarta.AbstractMainControl; import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.DefaultMapManager; @@ -433,7 +434,7 @@ * @param mapControlFactory the map control factory instance to use */ protected TestMainControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final RendererFactory<TestGameObject, TestMapArchObject, TestArchetype> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<TestAnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final MapControlFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapControlFactory) { - super(gridartaObjectsFactory, rendererFactory, key, globalSettings, animationObjects, faceObjects, mapControlFactory, true, null, null, "test.jar"); + super(gridartaObjectsFactory, rendererFactory, key, globalSettings, animationObjects, faceObjects, mapControlFactory, true, null, null, "test.jar", new TestFileFilter(), ".script"); } /** {@inheritDoc} */ @@ -502,6 +503,23 @@ } /** + * A {@link FileFilter} implementation for testing purposes. + */ + private static class TestFileFilter extends FileFilter { + + /** {@inheritDoc} */ + public boolean accept(final File f) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public String getDescription() { + throw new AssertionError(); + } + + } + + /** * A {@link MapControl} implementation for testing purposes. */ private static class TestMapControl extends DefaultMapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |