Skip to content

Commit

Permalink
Code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
DjThunder committed Dec 14, 2023
1 parent 8f268e0 commit 5a93f6d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,44 +48,6 @@ public class ApplicationConfiguration
/** Logger. */
private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationConfiguration.class);

/**
* Import a project from a path.
*
* @param projectPath The project path.
*/
private static void importProject(String projectPath)
{
final File path = new File(projectPath);
try
{
final Project project = ProjectFactory.create(path.getCanonicalFile());
ProjectImportHandler.importProject(project);
}
catch (final IOException exception)
{
LOGGER.error("importProject error", exception);
}
}

/**
* Check if there is a project to import.
*/
private static void checkProjectImport()
{
final String[] args = Platform.getApplicationArgs();
for (int i = 0; i < args.length; i++)
{
if (ARG_IMPORT.equals(args[i]))
{
i++; // CHECKSTYLE IGNORE LINE: TrailingComment|ModifiedControlVariable
if (i < args.length)
{
importProject(args[i]);
}
}
}
}

/** Application reference. */
private final MApplication application;

Expand Down Expand Up @@ -120,6 +82,44 @@ public void execute(IEventBroker eventBroker)
*/
private static final class AppStartupCompleteEventHandler implements EventHandler
{
/**
* Import a project from a path.
*
* @param projectPath The project path.
*/
private static void importProject(String projectPath)
{
final File path = new File(projectPath);
try
{
final Project project = ProjectFactory.create(path.getCanonicalFile());
ProjectImportHandler.importProject(project);
}
catch (final IOException exception)
{
LOGGER.error("importProject error", exception);
}
}

/**
* Check if there is a project to import.
*/
private static void checkProjectImport()
{
final String[] args = Platform.getApplicationArgs();
for (int i = 0; i < args.length; i++)
{
if (ARG_IMPORT.equals(args[i]))
{
i++; // CHECKSTYLE IGNORE LINE: TrailingComment|ModifiedControlVariable
if (i < args.length)
{
importProject(args[i]);
}
}
}
}

/**
* Constructor.
*/
Expand Down
4 changes: 2 additions & 2 deletions sample-game/src/test/java/com/b3dgs/sample/ConstantTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
/**
* Test {@link Constant}.
*/
public class ConstantTest
final class ConstantTest
{
/**
* Test all.
*/
@Test
public void testAll()
void testAll()
{
Assertions.assertEquals("Sample", Constant.PROGRAM_NAME);
Assertions.assertEquals("1.0.0", Constant.PROGRAM_VERSION.toString());
Expand Down

0 comments on commit 5a93f6d

Please sign in to comment.