content: package oscfg.diagram.providers;
  
  import org.eclipse.emf.transaction.TransactionalEditingDomain;
  import org.eclipse.emf.validation.model.IClientSelector;
  import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider;
  import org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor;
  import org.eclipse.gmf.runtime.notation.View;
  import org.eclipse.jface.action.IAction;
  
  import oscfg.diagram.edit.parts.ConfigurationEditPart;
  import oscfg.diagram.part.OscfgDiagramEditorPlugin;
  import oscfg.diagram.part.OscfgVisualIDRegistry;
  import oscfg.diagram.part.ValidateAction;
  
  /**
   * @generated
   */
  public class OscfgValidationProvider {
  
  	/**
  	 * @generated
  	 */
  	private static boolean constraintsActive = false;
  
  	/**
  	 * @generated
  	 */
  	public static boolean shouldConstraintsBePrivate() {
  		return false;
  	}
  
  	/**
  	 * @generated
  	 */
  	public static void runWithConstraints(
  			TransactionalEditingDomain editingDomain, Runnable operation) {
  		final Runnable op = operation;
  		Runnable task = new Runnable() {
  			public void run() {
  				try {
  					constraintsActive = true;
  					op.run();
  				} finally {
  					constraintsActive = false;
  				}
  			}
  		};
  		if (editingDomain != null) {
  			try {
  				editingDomain.runExclusive(task);
  			} catch (Exception e) {
  				OscfgDiagramEditorPlugin.getInstance().logError(
  						"Validation failed", e); //$NON-NLS-1$
  			}
  		} else {
  			task.run();
  		}
  	}
  
  	/**
  	 * @generated
  	 */
  	static boolean isInDefaultEditorContext(Object object) {
  		if (shouldConstraintsBePrivate() && !constraintsActive) {
  			return false;
  		}
  		if (object instanceof View) {
  			return constraintsActive
  					&& ConfigurationEditPart.MODEL_ID
  							.equals(OscfgVisualIDRegistry
  									.getModelID((View) object));
  		}
  		return true;
  	}
  
  	/**
  	 * @generated
  	 */
  	public static class DefaultCtx implements IClientSelector {
  
  		/**
  		 * @generated
  		 */
  		public boolean selects(Object object) {
  			return isInDefaultEditorContext(object);
  		}
  	}
  
  }
  