Package de.innovationgate.eclipse.editors.helpers

Source Code of de.innovationgate.eclipse.editors.helpers.DesignDBLookup

/*******************************************************************************
* 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.io.IOException;
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.Plugin;
import de.innovationgate.eclipse.editors.tml.TMLRegion;
import de.innovationgate.eclipse.utils.wga.WGADesignStructureHelper;
import de.innovationgate.wga.common.beans.csconfig.v2.Shortcut;
import de.innovationgate.wga.model.WGADesignConfigurationModel;

/**
* lookup for designdb attribute for e.g. on tml:include, tml:portlet
*
*
*/
public class DesignDBLookup implements AttributeValueLookup {

  public Set<String> lookupValues(TMLRegion region, IDocument document, ITextViewer viewer, IFile activeFile) {
    Set<String> values = new HashSet<String>();
   
    WGADesignStructureHelper helper = new WGADesignStructureHelper(activeFile);   
    try {
      WGADesignConfigurationModel model  = helper.createModel();
      if (model.isFeatureSupported(WGADesignConfigurationModel.FEATURE_SHORTCUTS)) {
        for (Shortcut shortCut : model.getShortcuts()) {
          if (shortCut.getType() == Shortcut.TYPE_PLUGIN) {
            values.add("@" + shortCut.getShortcut());
          }
        }
      }
    } catch (IOException e) {
      Plugin.getDefault().logError("Unable to create design configuration model for design db lookup.", e);
    }
   
    return values;
  }
}
TOP

Related Classes of de.innovationgate.eclipse.editors.helpers.DesignDBLookup

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.