{
if ( input instanceof FileEditorInput )
// The 'FileEditorInput' class is used when the file is opened
// from a project in the workspace.
{
ServerConfigurationParser parser = new ServerConfigurationParser();
serverConfiguration = parser.parse( ( ( FileEditorInput ) input ).getFile().getContents() );
}
else if ( input instanceof IPathEditorInput )
{
ServerConfigurationParser parser = new ServerConfigurationParser();
serverConfiguration = parser.parse( new FileInputStream( new File( ( ( IPathEditorInput ) input )
.getPath().toOSString() ) ) );
}
else if ( inputClassName.equals( "org.eclipse.ui.internal.editors.text.JavaFileEditorInput" )
|| inputClassName.equals( "org.eclipse.ui.ide.FileStoreEditorInput" ) )
// The class 'org.eclipse.ui.internal.editors.text.JavaFileEditorInput'
// is used when opening a file from the menu File > Open... in Eclipse 3.2.x
// The class 'org.eclipse.ui.ide.FileStoreEditorInput' is used when
// opening a file from the menu File > Open... in Eclipse 3.3.x
{
// We use the tooltip to get the full path of the file
ServerConfigurationParser parser = new ServerConfigurationParser();
serverConfiguration = parser.parse( new FileInputStream( new File( input.getToolTipText() ) ) );
}
else if ( input instanceof NonExistingServerConfigurationInput )
{
// The 'ServerConfigurationEditorInput' class is used when a
// new Server Configuration File is created.