/*- * Copyright © 2012 Diamond Light Source Ltd. * * This file is part of GDA. * * GDA is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 as published by the Free * Software Foundation. * * GDA 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. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with GDA. If not, see <http://www.gnu.org/licenses/>. */ package uk.ac.gda.lookuptable.editor; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import org.eclipse.core.runtime.QualifiedName; import org.eclipse.core.runtime.content.IContentDescriber; import org.eclipse.core.runtime.content.IContentDescription; public class LookupTableContentTypeDescriber implements IContentDescriber { public LookupTableContentTypeDescriber() { // TODO Auto-generated constructor stub } @Override public int describe(InputStream contents, IContentDescription description) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(contents)); String nextLine; while (((nextLine = br.readLine()) != null) && (nextLine.length() > 0)) { if (nextLine.startsWith("#")) { continue; } if (nextLine.startsWith("ScannableNames")) { return VALID; } } return INVALID; } @Override public QualifiedName[] getSupportedOptions() { // TODO Auto-generated method stub return null; } }