/*******************************************************************************
* Copyright (c) 2009, 2010 Innovation Gate GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Innovation Gate GmbH - initial API and implementation
******************************************************************************/
package de.innovationgate.eclipse.editors.helpers;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextViewer;
import de.innovationgate.eclipse.editors.tml.TMLRegion;
import de.innovationgate.eclipse.utils.wga.WGADesignStructureHelper;
public class LabelKeyLookup implements AttributeValueLookup {
public Set<String> lookupValues(TMLRegion region, IDocument document, ITextViewer viewer, IFile activeFile) {
Set<String> labelKeys = new HashSet<String>();
WGADesignStructureHelper designHelper = new WGADesignStructureHelper(activeFile);
if (region.getTagName() != null && region.getTagName().equals("label")) {
String labelFilename = "general";
if (region.hasAttribute("file") && !region.isDynamicAttributeValue("file")) {
labelFilename = region.getAttributeValue("file");
}
labelKeys.addAll(designHelper.getLabelKeys(labelFilename));
}
return labelKeys;
}
}