-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 4387_video_recording
- Loading branch information
Showing
11 changed files
with
887 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
org.mwc.debrief.core/src/org/mwc/debrief/core/contenttype/NMEA_Radar_ContentDescriber.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/******************************************************************************* | ||
* Debrief - the Open Source Maritime Analysis Application | ||
* http://debrief.info | ||
* | ||
* (C) 2000-2020, Deep Blue C Technology Ltd | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the Eclipse Public License v1.0 | ||
* (http://www.eclipse.org/legal/epl-v10.html) | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
*******************************************************************************/ | ||
package org.mwc.debrief.core.contenttype; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.InputStreamReader; | ||
import java.util.concurrent.atomic.AtomicBoolean; | ||
|
||
import org.eclipse.core.internal.content.TextContentDescriber; | ||
import org.eclipse.core.runtime.IStatus; | ||
import org.eclipse.core.runtime.content.IContentDescription; | ||
import org.mwc.cmap.core.CorePlugin; | ||
|
||
import Debrief.ReaderWriter.FlatFile.NMEA_Radar_FileImporter; | ||
import MWC.GUI.ErrorLogger; | ||
|
||
/** | ||
* import format test for SATC export files | ||
* | ||
* @author ian | ||
* | ||
*/ | ||
@SuppressWarnings("restriction") | ||
public class NMEA_Radar_ContentDescriber extends TextContentDescriber { | ||
|
||
@Override | ||
public int describe(final InputStream contents, final IContentDescription description) throws IOException { | ||
BufferedReader r = null; | ||
final AtomicBoolean res = new AtomicBoolean(); | ||
try { | ||
r = new BufferedReader(new InputStreamReader(contents)); | ||
final ErrorLogger logger = CorePlugin.getToolParent(); | ||
final boolean canRead = NMEA_Radar_FileImporter.canLoad(logger, r); | ||
res.set(canRead); | ||
} catch (final Exception e) { | ||
CorePlugin.logError(IStatus.ERROR, "NMEA Radar content type error", e); | ||
} finally { | ||
try { | ||
if (r != null) | ||
r.close(); | ||
} catch (final IOException e) { | ||
CorePlugin.logError(IStatus.ERROR, "Couldn't close file", e); | ||
} | ||
} | ||
if (res.get()) { | ||
return VALID; | ||
} else { | ||
return super.describe(contents, description); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.