blob: 9bfcc92039bfede41f559c463860cde404bd3807 [file] [log] [blame]
/**
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* 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:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*
* This copyright notice shows up in the generated Java code
*/
package org.eclipse.osbp.xtext.perspective.validation;
import com.google.common.base.Objects;
import org.eclipse.osbp.xtext.blip.Blip;
import org.eclipse.osbp.xtext.perspective.Activator;
import org.eclipse.osbp.xtext.perspective.Perspective;
import org.eclipse.osbp.xtext.perspective.PerspectiveDslPackage;
import org.eclipse.osbp.xtext.perspective.validation.AbstractPerspectiveDslValidator;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.validation.Check;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
/**
* Custom validation rules.
*
* see http://www.eclipse.org/Xtext/documentation.html#validation
*/
@SuppressWarnings("all")
public class PerspectiveDslValidator extends AbstractPerspectiveDslValidator {
@Check
public void checkBPMlicensed(final Perspective pers) {
Blip _process = pers.getProcess();
boolean _notEquals = (!Objects.equal(_process, null));
if (_notEquals) {
BundleContext _context = Activator.getContext();
Bundle[] _bundles = _context.getBundles();
for (final Bundle b : _bundles) {
String _symbolicName = b.getSymbolicName();
boolean _equals = _symbolicName.equals("net.osbee.bpm");
if (_equals) {
return;
}
}
StringConcatenation _builder = new StringConcatenation();
_builder.append("BPM is needed and not yet licensed. License BPM at www.osbee.net");
this.info(_builder.toString(), pers,
PerspectiveDslPackage.Literals.PERSPECTIVE__PROCESS);
}
}
}