text:
<?php

namespace ZucchiModel\Model;

use Zend\Code\Annotation\AnnotationManager;
use Zend\Code\Annotation\Parser;
use Zend\Code\Reflection\ClassReflection;

use Zend\EventManager\EventManager;
use Zend\EventManager\Event;
use Zend\EventManager\EventManagerInterface;
use Zend\EventManager\EventManagerAwareInterface;
use Zend\EventManager\EventManagerAwareTrait;

use ZucchiModel\Adapter\AdapterInterface;
use ZucchiModel\Behaviour;
use ZucchiModel\Hydrator;
use ZucchiModel\Annotation\AnnotationListener;
use ZucchiModel\Metadata;
use ZucchiModel\Query\Criteria;
use ZucchiModel\ResultSet;

/**
 * Model Manager for ORM
 *
 * @author Matt Cockayne <matt@zucchi.co.uk>
 * @author Rick Nicol <rick@zucchi.co.uk>
 * @package ZucchiModel
 * @subpackage Model
 * @category
 */
class Manager implements EventManagerAwareInterface
{
    /**
     * Zend Db Adapter used for connecting to the database.
     *
     * @var \ZucchiModel\Adapter\AdapterInterface
     */
    protected $adapter;

    /**
     * SQL object used to create SQL statements.
     *
     * @var \Zend\Db\Sql\Sql
     */
    protected $sql;

    /**
     * Event Manager.
     *
     * @var EventManager
     */
    protected $eventManager;

    /**
     * Annatation Manager.
     *
     * @var AnnotationManager;
     */
    protected $annotationManager;

    /**
     * Mapping data for loaded models.
     *
     * @var array
     */
    protected $modelMetadata = array();

    /**
     * Container of models to persist.
     *
     * @var Container
     */
    protected $modelContainer;

    /**
     * Queue of models to create.
     *
     * @var ArrayObject
     */
    protected $createQueue;

    /**
     * Queue of models to update.
     *
     * @var ArrayObject
     */
    protected $updateQueue;

    /**
     * Queue of models to remove.
     *
     * @var \ArrayObject
     */
    protected $removeQueue;

    /**
     * Collection of know Annotations related to Model Manager.
     *
     * @var array
     */
    protected $registeredAnnotations = array(
        'ZucchiModel\Annotation\Field',
        'ZucchiModel\Annotation\Relationship',
        'ZucchiModel\Annotation\Target',
    );

    /**
     * Construct Model Manager with supplied ZucchiModel Adapter.
     *
     * @param AdapterInterface $adapter
     */
    public function __construct(AdapterInterface $adapter)
    {
        $this->setAdapter($adapter);
        $this->resetQueue('create');
        $this->resetQueue('update');
        $this->resetQueue('remove');
    }

    /**
     * Reset the relevant queue.
     *
     * @param string $queue
     */
    protected function resetQueue($queue)
    {
        switch ($queue) {
            case 'create':
            case 'update':
            case 'remove':
                $this->{$queue . 'Queue'} = new \ArrayObject();;
        }
    }

    /**
     * Get ZucchiModel Adapter.
     *
     * @return \ZucchiModel\Adapter\AdapterInterface
     */
    public function getAdapter()
    {
        return $this->adapter;
    }

    /**
     * Set Zend Db Adapter.
     *
     * @param \ZucchiModel\Adapter\AdapterInterface $adapter
     * @return Manager
     */
    public function setAdapter(AdapterInterface $adapter)
    {
        $adapter->setEventManager($this->getEventManager());
        $this->adapter = $adapter;
        return $this;
    }

    /**
     * Get Event Manager.
     *
     * @return EventManagerInterface
     */
    public function getEventManager()
    {
        if (null === $this->eventManager) {
            $this->setEventManager(new EventManager());
        }
        return $this->eventManager;
    }

    /**
     * Set Event Manager.
     *
     * @param EventManagerInterface $events
     * @return $this
     */
    public function setEventManager(EventManagerInterface $events)
    {
        $events->setIdentifiers(array(
            __CLASS__,
            get_class($this),
        ));
        $annotationListener = new AnnotationListener();
        $annotationListener->attach($events);

        $hydrationListener = new Hydrator\HydrationListener($this);
        $hydrationListener->attach($events);

        $behaviourListener = new Behaviour\BehaviourListener($this);
        $behaviourListener->attach($events);

        $this->eventManager = $events;
        return $this;
    }

    /**
     * Get Annotation Manager.
     *
     * @return \Zend\Code\Annotation\AnnotationManager
     */
    public function getAnnotationManager()
    {
        if (!$this->annotationManager) {
            $this->annotationManager = new AnnotationManager();
            $parser = new Parser\DoctrineAnnotationParser();
            foreach ($this->registeredAnnotations as $annotation) {
                $parser->registerAnnotation($annotation);
            }
            $this->annotationManager->attach($parser);
        }
        return $this->annotationManager;
    }

    /**
     * Set Annotation Manager.
     *
     * @param \Zend\Code\Annotation\AnnotationManager $annotationManager
     */
    public function setAnnotationManager(AnnotationManager $annotationManager)
    {
        $this->annotationManager = $annotationManager;
    }

    /**
     * Get Metadata for a specified given class name.
     *
     * @param string $class
     * @return mixed
     * @throws \InvalidArgumentException
     */
    public function getMetadata($class)
    {
        // Class name must be a string
        if (!is_string($class)) {
            throw new \InvalidArgumentException(sprintf('Class must be a string. Given: %s.', var_export($class, true)));
        }

        if (!array_key_exists($class, $this->modelMetadata)) {
            // Add class to cache
            $this->modelMetadata[$class] = $md = new Metadata\MetaDataContainer();

            // Get the Model's Annotations
            $reflection  = new ClassReflection($class);
            $am = $this->getAnnotationManager();
            $em = $this->getEventManager();

            // Find all the Model Metadata
            if ($annotations = $reflection->getAnnotations($am)) {
                $event = new Event();
                $event->setName('prepareModelMetadata');
                $event->setTarget($annotations);
                $event->setParam('model', $md->getModel());
                $event->setParam('relationships', $md->getRelationships());
                $em->trigger($event);
            }

            // Find all the Fields Metadata
            if ($properties = $reflection->getProperties()) {
                $event = new Event();
                $event->setName('prepareFieldMetadata');
                $event->setTarget($md->getFields());
                foreach ($properties as $property) {
                    if ($annotation = $property->getAnnotations($am)) {
                        $event->setParam('property', $property->getName());
                        $event->setParam('annotation', $annotation);
                        $em->trigger($event);
                    }
                }
            }

            // Check for Data Sources and get their Table Name
            if ($target = $md->getModel()->getTarget()) {
                $md->setAdapter($this->getAdapter()->getMetaData($target));
            }
        }

        return $this->modelMetadata[$class];
    }

    /**
     * Get given Relationships.
     *
     * @param $relationship
     * @param $model
     * @param int $paginatedPageSize
     * @return bool|ResultSet\HydratingResultSet|ResultSet\PaginatedResultSet false if nothing can be found
     */
    public function getRelationship($relationship, $model, $paginatedPageSize = 0)
    {
        // Check relationship is a string.
        if (!is_string($relationship) || empty($relationship)) {
            throw new \InvalidArgumentException(sprintf('Relationship must be a non empty string. Given: %s', var_export($relationship, true)));
        }

        // Check model is an object.
        if (!is_object($model)) {
            throw new \InvalidArgumentException(sprintf('Models must be an object. Given: %s', var_export($model, true)));
        }

        // Check paginatedPageSize is an integer.
        if (!is_int($paginatedPageSize) || $paginatedPageSize < 0) {
            throw new \InvalidArgumentException(sprintf('Paginated Page Size must be a positive integer. Given: %s', var_export($paginatedPageSize, true)));
        }

        $metadata = $this->getMetadata(get_class($model));
        $relationship = $metadata->getRelationships()->getRelationship($relationship);

        // Create Criteria for the find.
        $criteria = new Criteria(array(
            'model' => $relationship['model'],
        ));
        // Add relationship details to criteria.
        $criteria = $metadata->getAdapter()->addRelationship(
            $model,
            $criteria,
            $relationship
        );

        // Find related models by join type.
        switch ($relationship['type']) {
            case 'toOne':
                return $this->findOne($criteria);
                break;
            case 'toMany':
            case 'ManytoMany':
                return $this->findAll($criteria, $paginatedPageSize);
                break;
        }

        // Nothing found.
        return false;
    }

    /**
     * Find and return a single model.
     *
     * @param Criteria $criteria
     * @return bool
     * @throws \RuntimeException
     * @todo: take into account schema and table names in foreignKeys
     * @todo: store results in mapCache
     * @todo: add listener for converting currency etc.
     */
    public function findOne(Criteria $criteria)
    {
        // Get model and check it exists
        $model = $criteria->getModel();
        if (!class_exists($model)) {
            throw new \RuntimeException(sprintf('Model does not exist. Given: %s', var_export($model, true)));
        }

        // Get metadata for the given model
        $metadata = $this->getMetadata($model);

        // Check dataSource and metadata exist
        if (!$metadata->getAdapter()) {
            throw new \RuntimeException(sprintf('No Adapter Specific Metadata can be found for this Model. Given: %s', var_export($model, true)));
        }

        $criteria->setLimit(1);

        $query = $this->getAdapter()->buildQuery($criteria, $metadata);

        $results = $this->getAdapter()->execute($query);

        // Check for single result
        if (!$result = $results->current()) {
            // return false as no result found
            return false;
        }

        $model = new $model();

        // Trigger Hydration events
        $event = new Event('preHydrate', $model, array('data' => $result));
        $this->getEventManager()->trigger($event);

        $event->setName('hydrate');
        $this->getEventManager()->trigger($event);

        $event->setName('postHydrate');
        $this->getEventManager()->trigger($event);

        // Return result
        return $model;
    }

    /**
     * Find and return a collection of models.
     *
     * @param Criteria $criteria
     * @param int $paginatedPageSize if greater than 1 then paginate results using this as Page Size
     * @return bool|ResultSet\HydratingResultSet|ResultSet\PaginatedResultSet
     * @throws \RuntimeException
     */
    public function findAll(Criteria $criteria, $paginatedPageSize = 0)
    {
        // Get model and check it exists
        $model = $criteria->getModel();

        if (!class_exists($model)) {
            throw new \RuntimeException(sprintf('Model does not exist. Given %s', var_export($model, true)));
        }

        // Get metadata for the given model
        $metadata = $this->getMetadata($model);

        // Check dataSource and metadata exist
        if (!$metadata->getAdapter()) {
            throw new \RuntimeException(sprintf('No Adapter Specific Metadata can be found for this Model. Given: %s', var_export($model, true)));
        }

        // Check if a Paginated Result Set is wanted,
        // else return standard Hydrating Result Set
        if ($paginatedPageSize > 0) {
            $resultSet = new ResultSet\PaginatedResultSet($this, $criteria, $paginatedPageSize);
        } else {
            $resultSet = $this->getAdapter()->find($criteria, $metadata);
        }

        return $resultSet;
    }

    /**
     * Return row count.
     *
     * @param Criteria $criteria
     * @return int|bool
     * @throws \RuntimeException
     */
    public function countAll(Criteria $criteria)
    {
        // Get model and check it exists
        $model = $criteria->getModel();

        if (!class_exists($model)) {
            throw new \RuntimeException(sprintf('Model does not exist. Given: %s', var_export($model, true)));
        }

        // Get metadata for the given model
        $metadata = $this->getMetadata($model);

        // Check dataSource and metadata exist
        if (!$metadata->getAdapter()) {
            throw new \RuntimeException(sprintf('No Adapter Specific Metadata can be found for this Model. Given: %s', var_export($model, true)));
        }

        // Force limit and offset to null
        $criteria->setLimit(null);
        $criteria->setOffset(null);

        $query = $this->getAdapter()->buildCountQuery($criteria, $metadata);

        $result = $this->getAdapter()->execute($query);

        if ($count = $result->current()) {
            return $count['count'];
        } else {
            return false;
        }
    }

    /**
     * Add model to modelContainer for later writing to datasource.
     *
     * @param $model
     * @param array $related
     * @throws \UnexpectedValueException
     * @throws \InvalidArgumentException
     */
    public function persist($model, $related = array())
    {
        // Check model is an object.
        if (!is_object($model)) {
            throw new \InvalidArgumentException(sprintf('Models must be an object. Given: %s', var_export($model, true)));
        }

        // Check $related is an array or Traversable.
        if (!is_array($related) && !($related instanceof \Traversable)) {
            throw new \InvalidArgumentException(sprintf('Related models must be an array or Traversable. Given: %s', var_export($related, true)));
        }

        // Create new container if not yet set.
        if (!$this->modelContainer) {
            $this->modelContainer = new Container($this);
        }

        $metadata = $this->getMetadata(get_class($model));

        // Build up a list of related model hashes.
        $modelRelations = array();

        foreach ($related as $name => $relations) {
            // Check this is a relationship on the given model.
            if (!$relationship = $metadata->getRelationship($name)) {
                throw new \UnexpectedValueException(sprintf('Invalid relationship of "%s" defined to persist.', $name));
            }

            // Attach each related model to model container, if not
            // already in modelContainer. Build list of hashes for
            // related models.
            foreach ($relations as $relation) {
                if (!$this->modelContainer->contains($relation)) {
                    $this->modelContainer->attach($relation, array(
                        'metadata' => $this->getMetadata($relationship['model']),
                        'relationships' => array(),
                    ));
                }
                $hash = $this->modelContainer->getHash($relation);
                $modelRelations[$name][] = $hash;
            }
        }

        // Attach this model to modelContainer.
        $hash = $this->modelContainer->getHash($model);

        // If it does not exists in modelContainer, attach with
        // related model hashes. Else merged related model hashes.
        if (!$this->modelContainer->contains($model)) {
            $this->modelContainer->attach($model, array(
                'metadata' => $metadata,
                'relationships' => $modelRelations,
            ));
        } else {
            $originalMeta = $this->modelContainer->offsetGet($model);
            $this->modelContainer->offsetSet($model, array(
                'metadata' => $metadata,
                'relationships' => array_merge($originalMeta['relationships'], $modelRelations),
            ));
        }

        // If hash contains fully qualified name, it is an
        // update. Else create. See Model\Container->getHash().
        if (false !== strpos($hash, get_class($model))) {
            $this->updateQueue[$hash] = true;
        } else {
            $this->createQueue[$hash] = true;
        }
    }

    /**
     * Write persisted models to dataSource.
     */
    public function write()
    {
        if ($this->modelContainer instanceof Container) {
            $this->getAdapter()->write($this->modelContainer);
        }

        // Clean out Model Container and Queues.
        unset($this->modelContainer, $this->createQueue, $this->updateQueue, $this->removeQueue);
        $this->modelContainer = $this->createQueue = $this->updateQueue = $this->removeQueue = null;
    }
}


text:
require 'test/unit'

class TC_Class_Superclass_InstanceMethod < Test::Unit::TestCase
   class Superclass
   end

   module SuperModule
   end

   class SubclassOne < Superclass
   end

   class SubclassTwo
      include SuperModule
   end

   class SubclassThree < Superclass
      include SuperModule
   end

   def test_superclass_basic
      assert_respond_to(Superclass, :superclass)
      assert_nothing_raised{ Superclass.superclass }
      assert_kind_of(Object, Superclass.superclass)
   end

   def test_superclass
      assert_equal(Object, Superclass.superclass)
      assert_equal(Superclass, SubclassOne.superclass)
   end

   def test_superclass_with_mixins
      assert_equal(Object, SubclassTwo.superclass)
      assert_equal(Superclass, SubclassThree.superclass)
   end
end

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Qt 4.8: gameengine.h Example File (demos/mobile/quickhit/gameengine.h)</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />

  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />

      Home

    Qt Reference Documentation

Qt HOME

DEV

          DOC

BLOG

Qt 4.8

ALL VERSIONS

API Lookup

Class index

Function index

Modules

Namespaces

Global Declarations

QML elements

Qt Topics

Programming with Qt

Device UIs & Qt Quick

UI Design with Qt

Supported Platforms

Qt and Key Technologies

How-To's and Best Practices

Examples

Examples

Tutorials

Demos

QML Examples

          Search index:

          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />

 Close

All | API | Articles | Examples

 results:

            </fieldset>
          </form>

            API Lookup

Class index

Function index

Modules

Namespaces

Global Declarations

QML elements

            Qt Topics

Programming with Qt

Device UIs & Qt Quick

UI Design with Qt

Supported Platforms

Qt and Key Technologies

How-To's and Best Practices

            Examples

Examples

Tutorials

Demos

QML Examples

Home

A

A

A

                Print

gameengine.h Example File

demos/mobile/quickhit/gameengine.h

 #ifndef GAMEENGINE_H
 #define GAMEENGINE_H

 #include <QObject>
 #include <QDeclarativeItem>
 #include <QMutex>
 #include <QPluginLoader>
 #include <QList>

 #ifdef Q_OS_SYMBIAN
 #include <hwrmvibra.h>
 #endif

 // QtMobility
 #if defined Q_OS_SYMBIAN || defined Q_WS_MAEMO_5
 #include <QSystemDeviceInfo>
 QTM_USE_NAMESPACE
 #endif

 class CInvSounds;
 class LevelPluginInterface;
 class GameEngine : public QObject
 {
     Q_OBJECT

 public:
     GameEngine(QObject* parent);
     ~GameEngine();
     void timerEvent(QTimerEvent *);
     void setGameLevel(LevelPluginInterface* level);
     void setPluginList(QList<QPluginLoader*> plugins);
     void pauseGame();

 public:
     Q_INVOKABLE void enableEngineTimer(QVariant enable);
     Q_INVOKABLE QVariant randInt(QVariant low, QVariant high);
     Q_INVOKABLE void enableSounds(QVariant enable);
     Q_INVOKABLE void playSound(QVariant index);
     Q_INVOKABLE void playSounds(QVariant index, QVariant count);
     Q_INVOKABLE void playInternalSound(QVariant index);
     Q_INVOKABLE void playInternalSounds(QVariant index, QVariant count);
     Q_INVOKABLE QVariant pluginList();
     Q_INVOKABLE void findQmlObjects();
     Q_INVOKABLE void clearQmlObjects();
     Q_INVOKABLE void pauseLevel(QVariant doPause);
     Q_INVOKABLE void gameStartSound();

     Q_INVOKABLE QVariant isSymbian();
     Q_INVOKABLE QVariant isMaemo();
     Q_INVOKABLE QVariant isWindows();

     Q_INVOKABLE void vibra();
     Q_INVOKABLE void fastVibra();

     Q_INVOKABLE void openLink(QVariant link);

 private slots:
 #if defined Q_OS_SYMBIAN || defined Q_WS_MAEMO_5
     void currentProfileChanged (QSystemDeviceInfo::Profile);
 #endif

 public:
     void setGameQml(QObject* o);

 private:
     void findMissiles(QObject* rootObject);
     void findEnemies(QObject* rootObject);
     void setLevelQml(QObject* o) {m_levelQml = o;}
     void setEnemiesGridQml(QObject* o);
     void setMyShipQml(QObject* o);
     void gameOver(bool youWin);
     void selectVisibleEnemy(int& start, int& end);

 private:
     void doHitTest();
     void doEnemyMissile();

 private:
     bool                        m_enableEnemyMissiles;
     QMutex                      m_enemyListMutex;
     QList<QDeclarativeItem*>    m_enemyList;
     QList<QDeclarativeItem*>    m_missileList;
     QList<QDeclarativeItem*>    m_enemyMissileList;
     QObject*                    m_levelQml;
     QDeclarativeItem*           m_enemiesGridGml;
     QDeclarativeItem*           m_myShipGml;
     QDeclarativeItem*           m_GameGml;

     LevelPluginInterface*       m_gameLevel;
     CInvSounds*                 m_soundEngine;
     QList<QPluginLoader*>       m_pluginList;

     int                         m_timerId;
     int                         m_doEnemyMissile;

 #if defined Q_OS_SYMBIAN || defined Q_WS_MAEMO_5
     QSystemDeviceInfo*          m_systemDeviceInfo;
 #endif
     bool                        m_silent;

 #ifdef Q_OS_SYMBIAN
     CHWRMVibra* iVibrate;
 #endif

 };

 #endif // GAMEENGINE_H

      <acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.

      The documentation provided herein is licensed under the terms of the
      GNU Free Documentation
      License version 1.3 as published by the Free Software Foundation.

      Documentation sources may be obtained from
      www.qt-project.org.

      Digia, Qt and their respective logos are trademarks of Digia Plc
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. Privacy Policy


text:
#ifndef LWSDK_SURF_H
#define LWSDK_SURF_H

typedef struct st_GCoreSurface          *LWSurfaceID;

#include        <lwrender.h>
#include        <lwtxtr.h>
#include        <lwenvel.h>
#include        <lwimage.h>

#define LWSURFACEFUNCS_GLOBAL   "Surface Functions 2"

#define SURF_COLR        "BaseColor"
#define SURF_LUMI        "Luminosity"
#define SURF_DIFF        "Diffuse"
#define SURF_SPEC        "Specularity"
#define SURF_REFL        "Reflectivity"
#define SURF_TRAN        "Transparency"
#define SURF_TRNL        "Translucency"
#define SURF_RIND        "IOR"
#define SURF_BUMP        "Bump"
#define SURF_GLOS        "Glossiness"
#define SURF_BUF1        "SpecialBuffer1"
#define SURF_BUF2        "SpecialBuffer2"
#define SURF_BUF3        "SpecialBuffer3"
#define SURF_BUF4    "SpecialBuffer4"
#define SURF_SHRP        "DiffuseSharpness"
#define SURF_SMAN        "SmoothingAngle"
#define SURF_RSAN        "ReflectionSeamAngle"
#define SURF_TSAN        "RefractionSeamAngle"
#define SURF_RBLR        "ReflectionBlurring"
#define SURF_TBLR        "RefractionBlurring"
#define SURF_CLRF        "ColorFilter"
#define SURF_CLRH        "ColorHighlights"
#define SURF_ADTR        "AdditiveTransparency"
#define SURF_AVAL        "AlphaValue"
#define SURF_GVAL        "GlowValue"
#define SURF_LCOL        "LineColor"
#define SURF_LSIZ        "LineSize"
#define SURF_ALPH        "AlphaOptions"
#define SURF_RFOP        "ReflectionOptions"
#define SURF_TROP        "RefractionOptions"
#define SURF_SIDE        "Sidedness"
#define SURF_GLOW        "Glow"
#define SURF_LINE        "RenderOutlines"
#define SURF_RIMG        "ReflectionImage"
#define SURF_TIMG        "RefractionImage"
#define SURF_VCOL        "VertexColoring"

typedef struct st_LWSurfaceFuncs {
        LWSurfaceID             (*create)(const char    *objName,const char     *surfName);
        LWSurfaceID             (*first)(void);
        LWSurfaceID             (*next)(LWSurfaceID     surf);
        LWSurfaceID             *(*byName)(const char   *name,const char        *objName);
        LWSurfaceID             *(*byObject)(const char *name);
        const char              *(*name)(LWSurfaceID    surf);
        const char              *(*sceneObject)(LWSurfaceID     surf);

        int                             (*getInt)(LWSurfaceID   surf,const char *channel);
        double                  *(*getFlt)(LWSurfaceID  surf,const char *channel);
        LWEnvelopeID    (*getEnv)(LWSurfaceID   surf,const char *channel);
        LWTextureID             (*getTex)(LWSurfaceID   surf,const char *channel);
        LWImageID               (*getImg)(LWSurfaceID   surf,const char *channel);

        LWChanGroupID   (*chanGrp)(LWSurfaceID  surf);
        const char              *(*getColorVMap)(LWSurfaceID    surf);
        void                    (*setColorVMap)(LWSurfaceID     surf,const char *vmapName,int   type);
} LWSurfaceFuncs;

#endif


text:
export class News {
    createdAt : any;
    title : string;
    content : string;
}


text:
from setuptools import setup

setup(
    include_package_data=True,
    setup_requires=['pbr'],
    pbr=True)


text:
package com.intellij.openapi.vcs.changes.shelf;

import com.intellij.CommonBundle;
import com.intellij.diff.DiffContentFactoryEx;
import com.intellij.diff.chains.DiffRequestProducerException;
import com.intellij.diff.impl.CacheDiffRequestProcessor;
import com.intellij.diff.requests.DiffRequest;
import com.intellij.diff.requests.SimpleDiffRequest;
import com.intellij.icons.AllIcons;
import com.intellij.ide.DataManager;
import com.intellij.ide.DeleteProvider;
import com.intellij.ide.actions.EditSourceAction;
import com.intellij.ide.dnd.*;
import com.intellij.ide.dnd.aware.DnDAwareTree;
import com.intellij.ide.util.treeView.TreeState;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.components.ProjectComponent;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.diff.impl.patch.FilePatch;
import com.intellij.openapi.diff.impl.patch.PatchSyntaxException;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Couple;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.*;
import com.intellij.openapi.vcs.changes.*;
import com.intellij.openapi.vcs.changes.actions.ShowDiffPreviewAction;
import com.intellij.openapi.vcs.changes.issueLinks.IssueLinkRenderer;
import com.intellij.openapi.vcs.changes.issueLinks.TreeLinkMouseListener;
import com.intellij.openapi.vcs.changes.patch.RelativePathCalculator;
import com.intellij.openapi.vcs.changes.patch.tool.PatchDiffRequest;
import com.intellij.openapi.vcs.changes.ui.ChangeListDragBean;
import com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager;
import com.intellij.openapi.vcs.changes.ui.ShelvedChangeListDragBean;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.pom.Navigatable;
import com.intellij.pom.NavigatableAdapter;
import com.intellij.ui.*;
import com.intellij.ui.treeStructure.Tree;
import com.intellij.util.IconUtil;
import com.intellij.util.IconUtil.IconSizeWrapper;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.messages.MessageBus;
import com.intellij.util.text.DateFormatUtil;
import com.intellij.util.ui.GraphicsUtil;
import com.intellij.util.ui.tree.TreeUtil;
import com.intellij.util.ui.update.MergingUpdateQueue;
import com.intellij.util.ui.update.Update;
import com.intellij.vcsUtil.VcsUtil;
import org.jetbrains.annotations.CalledInAwt;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import javax.swing.event.*;
import javax.swing.tree.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.List;

import static com.intellij.icons.AllIcons.Vcs.Patch_applied;
import static com.intellij.openapi.actionSystem.Anchor.AFTER;
import static com.intellij.openapi.vcs.changes.shelf.DiffShelvedChangesActionProvider.createAppliedTextPatch;
import static com.intellij.util.FontUtil.spaceAndThinSpace;
import static com.intellij.util.ObjectUtils.assertNotNull;
import static com.intellij.util.containers.ContainerUtil.notNullize;

public class ShelvedChangesViewManager implements ProjectComponent {

  private static final Logger LOG = Logger.getInstance(ShelvedChangesViewManager.class);
  @NonNls static final String SHELF_CONTEXT_MENU = "Vcs.Shelf.ContextMenu";
  private static final String SHELVE_PREVIEW_SPLITTER_PROPORTION = "ShelvedChangesViewManager.DETAILS_SPLITTER_PROPORTION";

  private final ChangesViewContentManager myContentManager;
  private final ShelveChangesManager myShelveChangesManager;
  private final Project myProject;
  private final ShelfTree myTree;
  private MyShelfContent myContent = null;
  private final DeleteProvider myDeleteProvider = new MyShelveDeleteProvider();
  private final MergingUpdateQueue myUpdateQueue;
  private final VcsConfiguration myVcsConfiguration;

  public static final DataKey<ShelvedChangeList[]> SHELVED_CHANGELIST_KEY = DataKey.create("ShelveChangesManager.ShelvedChangeListData");
  public static final DataKey<ShelvedChangeList[]> SHELVED_RECYCLED_CHANGELIST_KEY = DataKey.create("ShelveChangesManager.ShelvedRecycledChangeListData");
  public static final DataKey<List<ShelvedChange>> SHELVED_CHANGE_KEY = DataKey.create("ShelveChangesManager.ShelvedChange");
  public static final DataKey<List<ShelvedBinaryFile>> SHELVED_BINARY_FILE_KEY = DataKey.create("ShelveChangesManager.ShelvedBinaryFile");
  private static final Object ROOT_NODE_VALUE = new Object();
  private DefaultMutableTreeNode myRoot;
  private final Map<Couple<String>, String> myMoveRenameInfo;
  private PreviewDiffSplitterComponent mySplitterComponent;

  public static ShelvedChangesViewManager getInstance(Project project) {
    return project.getComponent(ShelvedChangesViewManager.class);
  }

  public ShelvedChangesViewManager(Project project, ChangesViewContentManager contentManager, ShelveChangesManager shelveChangesManager,
                                   final MessageBus bus) {
    myProject = project;
    myContentManager = contentManager;
    myShelveChangesManager = shelveChangesManager;
    myUpdateQueue = new MergingUpdateQueue("Update Shelf Content", 200, true, null, myProject, null, true);
    myVcsConfiguration = VcsConfiguration.getInstance(myProject);
    bus.connect().subscribe(ShelveChangesManager.SHELF_TOPIC, new ChangeListener() {
      @Override
      public void stateChanged(ChangeEvent e) {
        myUpdateQueue.queue(new MyContentUpdater());
      }
    });
    myMoveRenameInfo = new HashMap<>();

    myTree = new ShelfTree();
    myTree.setRootVisible(false);
    myTree.setShowsRootHandles(true);
    myTree.setEditable(true);
    myTree.setHorizontalAutoScrollingEnabled(false);
    myTree.setCellRenderer(new ShelfTreeCellRenderer(project, myMoveRenameInfo));
    DefaultTreeCellEditor treeCellEditor = new DefaultTreeCellEditor(myTree, null) {
      @Override
      public boolean isCellEditable(EventObject event) {
        return !(event instanceof MouseEvent) && super.isCellEditable(event);
      }
    };
    myTree.setCellEditor(treeCellEditor);
    treeCellEditor.addCellEditorListener(new CellEditorListener() {
      @Override
      public void editingStopped(ChangeEvent e) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode)myTree.getLastSelectedPathComponent();
        if (node != null && node instanceof ShelvedListNode && e.getSource() instanceof TreeCellEditor) {
          String editorValue = ((TreeCellEditor)e.getSource()).getCellEditorValue().toString();
          ShelvedChangeList shelvedChangeList = ((ShelvedListNode)node).getList();
          ShelveChangesManager.getInstance(project).renameChangeList(shelvedChangeList, editorValue);
          myTree.getModel().valueForPathChanged(TreeUtil.getPathFromRoot(node), shelvedChangeList);
        }
      }

      @Override
      public void editingCanceled(ChangeEvent e) {
      }
    });
    new TreeLinkMouseListener(new ShelfTreeCellRenderer(project, myMoveRenameInfo)).installOn(myTree);

    final AnAction showDiffAction = ActionManager.getInstance().getAction(IdeActions.ACTION_SHOW_DIFF_COMMON);
    showDiffAction.registerCustomShortcutSet(showDiffAction.getShortcutSet(), myTree);
    final EditSourceAction editSourceAction = new EditSourceAction();
    editSourceAction.registerCustomShortcutSet(editSourceAction.getShortcutSet(), myTree);

    PopupHandler.installPopupHandler(myTree, "ShelvedChangesPopupMenu", SHELF_CONTEXT_MENU);

    new DoubleClickListener() {
      @Override
      protected boolean onDoubleClick(MouseEvent e) {
        DataContext dc = DataManager.getInstance().getDataContext(myTree);
        if (getShelveChanges(dc).isEmpty() && getBinaryShelveChanges(dc).isEmpty()) return false;
        DiffShelvedChangesActionProvider.showShelvedChangesDiff(dc);
        return true;
      }
    }.installOn(myTree);

    new TreeSpeedSearch(myTree, o -> {
      final Object lc = o.getLastPathComponent();
      final Object lastComponent = lc == null ? null : ((DefaultMutableTreeNode) lc).getUserObject();
      if (lastComponent instanceof ShelvedChangeList) {
        return ((ShelvedChangeList) lastComponent).DESCRIPTION;
      } else if (lastComponent instanceof ShelvedChange) {
        final ShelvedChange shelvedChange = (ShelvedChange)lastComponent;
        return shelvedChange.getBeforeFileName() == null ? shelvedChange.getAfterFileName() : shelvedChange.getBeforeFileName();
      } else if (lastComponent instanceof ShelvedBinaryFile) {
        final ShelvedBinaryFile sbf = (ShelvedBinaryFile) lastComponent;
        final String value = sbf.BEFORE_PATH == null ? sbf.AFTER_PATH : sbf.BEFORE_PATH;
        int idx = value.lastIndexOf("/");
        idx = (idx == -1) ? value.lastIndexOf("\\") : idx;
        return idx > 0 ? value.substring(idx + 1) : value;
      }
      return null;
    }, true);
    myTree.addTreeSelectionListener(new TreeSelectionListener() {
      @Override
      public void valueChanged(TreeSelectionEvent e) {
        mySplitterComponent.updatePreview();
      }
    });
  }

  @Override
  public void projectOpened() {
    StartupManager startupManager = StartupManager.getInstance(myProject);
    if (startupManager == null) {
      LOG.error("Couldn't start loading shelved changes");
      return;
    }
    startupManager.registerPostStartupActivity((DumbAwareRunnable)() -> myUpdateQueue.queue(new MyContentUpdater()));
  }

  @Override
  @NonNls @NotNull
  public String getComponentName() {
    return "ShelvedChangesViewManager";
  }

  @CalledInAwt
  private void updateChangesContent() {
    final List<ShelvedChangeList> changeLists = new ArrayList<>(myShelveChangesManager.getShelvedChangeLists());
    changeLists.addAll(myShelveChangesManager.getRecycledShelvedChangeLists());
    if (changeLists.size() == 0) {
      if (myContent != null) {
        myContentManager.removeContent(myContent);
        myContentManager.selectContent(ChangesViewContentManager.LOCAL_CHANGES);
      }
      myContent = null;
    }
    else {
      if (myContent == null) {
        myTree.updateUI();
        JPanel rootPanel = createRootPanel();
        myContent = new MyShelfContent(rootPanel, VcsBundle.message("shelf.tab"), false);
        myContent.setCloseable(false);
        myContentManager.addContent(myContent);
        DnDSupport.createBuilder(myTree)
          .setImageProvider(this::createDraggedImage)
          .setBeanProvider(this::createDragStartBean)
          .setTargetChecker(myContent)
          .setDropHandler(myContent)
          .setDisposableParent(myContent)
          .install();
      }
      TreeState state = TreeState.createOn(myTree);
      myTree.setModel(buildChangesModel());
      state.applyTo(myTree);
    }
  }

  private ToolWindow getVcsToolWindow() {
    return ToolWindowManager.getInstance(myProject).getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID);
  }

  @NotNull
  private JPanel createRootPanel() {
    JScrollPane pane = ScrollPaneFactory.createScrollPane(myTree);
    pane.setBorder(null);

    DefaultActionGroup actionGroup = new DefaultActionGroup();
    actionGroup.addAll((ActionGroup)ActionManager.getInstance().getAction("ShelvedChangesToolbar"));
    actionGroup.add(new MyToggleDetailsAction(), new Constraints(AFTER, "ShelvedChanges.ShowHideDeleted"));

    MyShelvedPreviewProcessor changeProcessor = new MyShelvedPreviewProcessor(myProject);
    mySplitterComponent = new PreviewDiffSplitterComponent(pane, changeProcessor, SHELVE_PREVIEW_SPLITTER_PROPORTION,
                                                           myVcsConfiguration.SHELVE_DETAILS_PREVIEW_SHOWN);
    ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("ShelvedChanges", actionGroup, false);

    JPanel rootPanel = new JPanel(new BorderLayout());
    rootPanel.add(toolbar.getComponent(), BorderLayout.WEST);
    rootPanel.add(mySplitterComponent, BorderLayout.CENTER);
    DataManager.registerDataProvider(rootPanel, myTree);

    return rootPanel;
  }

  private TreeModel buildChangesModel() {
    myRoot = new DefaultMutableTreeNode(ROOT_NODE_VALUE);   // not null for TreeState matching to work
    DefaultTreeModel model = new DefaultTreeModel(myRoot);
    final List<ShelvedChangeList> changeLists = new ArrayList<>(myShelveChangesManager.getShelvedChangeLists());
    Collections.sort(changeLists, ChangelistComparator.getInstance());
    if (myShelveChangesManager.isShowRecycled()) {
      ArrayList<ShelvedChangeList> recycled = new ArrayList<>(myShelveChangesManager.getRecycledShelvedChangeLists());
      changeLists.addAll(recycled);
      Collections.sort(changeLists, ChangelistComparator.getInstance());
    }
    myMoveRenameInfo.clear();

    for(ShelvedChangeList changeList: changeLists) {
      DefaultMutableTreeNode node = new ShelvedListNode(changeList);
      model.insertNodeInto(node, myRoot, myRoot.getChildCount());

      final List<Object> shelvedFilesNodes = new ArrayList<>();
      List<ShelvedChange> changes = changeList.getChanges(myProject);
      for(ShelvedChange change: changes) {
        putMovedMessage(change.getBeforePath(), change.getAfterPath());
        shelvedFilesNodes.add(change);
      }
      List<ShelvedBinaryFile> binaryFiles = changeList.getBinaryFiles();
      for(ShelvedBinaryFile file: binaryFiles) {
        putMovedMessage(file.BEFORE_PATH, file.AFTER_PATH);
        shelvedFilesNodes.add(file);
      }
      Collections.sort(shelvedFilesNodes, ShelvedFilePatchComparator.getInstance());
      for (int i = 0; i < shelvedFilesNodes.size(); i++) {
        final Object filesNode = shelvedFilesNodes.get(i);
        final DefaultMutableTreeNode pathNode = new DefaultMutableTreeNode(filesNode);
        model.insertNodeInto(pathNode, node, i);
      }
    }
    return model;
  }

  @CalledInAwt
  public void startEditing(@NotNull ShelvedChangeList shelvedChangeList) {
    runAfterUpdate(() -> {
      selectShelvedList(shelvedChangeList);
      myTree.startEditingAtPath(myTree.getLeadSelectionPath());
    });
  }

  private static class ChangelistComparator implements Comparator<ShelvedChangeList> {
    private final static ChangelistComparator ourInstance = new ChangelistComparator();

    public static ChangelistComparator getInstance() {
      return ourInstance;
    }

    @Override
    public int compare(ShelvedChangeList o1, ShelvedChangeList o2) {
      return o2.DATE.compareTo(o1.DATE);
    }
  }

  private void putMovedMessage(final String beforeName, final String afterName) {
    final String movedMessage = RelativePathCalculator.getMovedString(beforeName, afterName);
    if (movedMessage != null) {
      myMoveRenameInfo.put(Couple.of(beforeName, afterName), movedMessage);
    }
  }

  public void activateView(@Nullable final ShelvedChangeList list) {
    runAfterUpdate(() -> {
      if (list != null) {
        selectShelvedList(list);
      }
      myContentManager.setSelectedContent(myContent);
      ToolWindow window = getVcsToolWindow();
      if (window != null && !window.isVisible()) {
        window.activate(null);
      }
    });
  }

  private void runAfterUpdate(@NotNull Runnable postUpdateRunnable) {
    GuiUtils.invokeLaterIfNeeded(() -> {
      myUpdateQueue.cancelAllUpdates();
      updateChangesContent();
      postUpdateRunnable.run();
    }, ModalityState.NON_MODAL);
  }

  @Override
  public void disposeComponent() {
    myUpdateQueue.cancelAllUpdates();
  }

  public void selectShelvedList(@NotNull ShelvedChangeList list) {
    DefaultMutableTreeNode treeNode = TreeUtil.findNodeWithObject(myRoot, list);
    if (treeNode == null) {
      LOG.warn(String.format("Shelved changeList %s not found", list.DESCRIPTION));
      return;
    }
    TreeUtil.selectNode(myTree, treeNode);
  }

  private class ShelfTree extends Tree implements DataProvider {

    @Override
    public boolean isPathEditable(TreePath path) {
      return isEditable() && myTree.getSelectionCount() == 1 && path.getLastPathComponent() instanceof ShelvedListNode;
    }

    @Nullable
    @Override
    public Object getData(@NonNls String dataId) {
      if (SHELVED_CHANGELIST_KEY.is(dataId)) {
        final Set<ShelvedChangeList> changeLists = getSelectedLists(false);

        if (changeLists.size() > 0) {
          return changeLists.toArray(new ShelvedChangeList[changeLists.size()]);
        }
      }
      else if (SHELVED_RECYCLED_CHANGELIST_KEY.is(dataId)) {
        final Set<ShelvedChangeList> changeLists = getSelectedLists(true);

        if (changeLists.size() > 0) {
          return changeLists.toArray(new ShelvedChangeList[changeLists.size()]);
        }
      }
      else if (SHELVED_CHANGE_KEY.is(dataId)) {
        return TreeUtil.collectSelectedObjectsOfType(this, ShelvedChange.class);
      }
      else if (SHELVED_BINARY_FILE_KEY.is(dataId)) {
        return TreeUtil.collectSelectedObjectsOfType(this, ShelvedBinaryFile.class);
      }
      else if (VcsDataKeys.HAVE_SELECTED_CHANGES.is(dataId)) {
        return getSelectionCount() > 0;
      }
      else if (VcsDataKeys.CHANGES.is(dataId)) {
        List<ShelvedChange> shelvedChanges = TreeUtil.collectSelectedObjectsOfType(this, ShelvedChange.class);
        final List<ShelvedBinaryFile> shelvedBinaryFiles = TreeUtil.collectSelectedObjectsOfType(this, ShelvedBinaryFile.class);
        if (!shelvedChanges.isEmpty() || !shelvedBinaryFiles.isEmpty()) {
          final List<Change> changes = new ArrayList<>(shelvedChanges.size() + shelvedBinaryFiles.size());
          for (ShelvedChange shelvedChange : shelvedChanges) {
            changes.add(shelvedChange.getChange(myProject));
          }
          for (ShelvedBinaryFile binaryFile : shelvedBinaryFiles) {
            changes.add(binaryFile.createChange(myProject));
          }
          return changes.toArray(new Change[changes.size()]);
        }
        else {
          final List<ShelvedChangeList> changeLists = TreeUtil.collectSelectedObjectsOfType(this, ShelvedChangeList.class);
          final List<Change> changes = new ArrayList<>();
          for (ShelvedChangeList changeList : changeLists) {
            shelvedChanges = changeList.getChanges(myProject);
            for (ShelvedChange shelvedChange : shelvedChanges) {
              changes.add(shelvedChange.getChange(myProject));
            }
            final List<ShelvedBinaryFile> binaryFiles = changeList.getBinaryFiles();
            for (ShelvedBinaryFile file : binaryFiles) {
              changes.add(file.createChange(myProject));
            }
          }
          return changes.toArray(new Change[changes.size()]);
        }
      }
      else if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
        return myDeleteProvider;
      }
      else if (CommonDataKeys.NAVIGATABLE_ARRAY.is(dataId)) {
        List<ShelvedChange> shelvedChanges = new ArrayList<>(TreeUtil.collectSelectedObjectsOfType(this, ShelvedChange.class));
        final ArrayDeque<Navigatable> navigatables = new ArrayDeque<>();
        final List<ShelvedChangeList> changeLists = TreeUtil.collectSelectedObjectsOfType(this, ShelvedChangeList.class);
        for (ShelvedChangeList changeList : changeLists) {
          shelvedChanges.addAll(changeList.getChanges(myProject));
        }
        for (final ShelvedChange shelvedChange : shelvedChanges) {
          if (shelvedChange.getBeforePath() != null && !FileStatus.ADDED.equals(shelvedChange.getFileStatus())) {
            final NavigatableAdapter navigatable = new NavigatableAdapter() {
              @Override
              public void navigate(boolean requestFocus) {
                final VirtualFile vf = shelvedChange.getBeforeVFUnderProject(myProject);
                if (vf != null) {
                  navigate(myProject, vf, true);
                }
              }
            };
            navigatables.add(navigatable);
          }
        }
        return navigatables.toArray(new Navigatable[navigatables.size()]);
      }
      return null;
    }

    private Set<ShelvedChangeList> getSelectedLists(final boolean recycled) {
      final TreePath[] selections = getSelectionPaths();
      final Set<ShelvedChangeList> changeLists = new HashSet<>();
      if (selections != null) {
        for(TreePath path: selections) {
          if (path.getPathCount() >= 2) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getPathComponent(1);
            if (node.getUserObject() instanceof ShelvedChangeList) {
              final ShelvedChangeList list = (ShelvedChangeList)node.getUserObject();
              if (((! recycled) && (! list.isRecycled())) ||
                  (recycled && list.isRecycled())) {
                changeLists.add(list);
              }
            }
          }
        }
      }
      return changeLists;
    }
  }

  @NotNull
  public static List<ShelvedChangeList> getShelvedLists(@NotNull final DataContext dataContext) {
    final ShelvedChangeList[] shelved = SHELVED_CHANGELIST_KEY.getData(dataContext);
    final ShelvedChangeList[] recycled = SHELVED_RECYCLED_CHANGELIST_KEY.getData(dataContext);
    if (shelved == null && recycled == null) return Collections.emptyList();
    List<ShelvedChangeList> shelvedChangeLists = ContainerUtil.newArrayList();
    if (shelved != null) {
      ContainerUtil.addAll(shelvedChangeLists, shelved);
    }
    if (recycled != null) {
      ContainerUtil.addAll(shelvedChangeLists, recycled);
    }
    return shelvedChangeLists;
  }

  @NotNull
  public static List<ShelvedChange> getShelveChanges(@NotNull final DataContext dataContext) {
    return notNullize(dataContext.getData(SHELVED_CHANGE_KEY));
  }

  @NotNull
  public static List<ShelvedBinaryFile> getBinaryShelveChanges(@NotNull final DataContext dataContext) {
    return notNullize(dataContext.getData(SHELVED_BINARY_FILE_KEY));
  }

  private final static class ShelvedFilePatchComparator implements Comparator<Object> {
    private final static ShelvedFilePatchComparator ourInstance = new ShelvedFilePatchComparator();

    public static ShelvedFilePatchComparator getInstance() {
      return ourInstance;
    }

    @Override
    public int compare(final Object o1, final Object o2) {
      final String path1 = getPath(o1);
      final String path2 = getPath(o2);
      // case-insensitive; as in local changes
      if (path1 == null) return -1;
      if (path2 == null) return 1;
      return path1.compareToIgnoreCase(path2);
    }

    private static String getPath(final Object patch) {
      String path = null;
      if (patch instanceof ShelvedBinaryFile) {
        final ShelvedBinaryFile binaryFile = (ShelvedBinaryFile) patch;
        path = binaryFile.BEFORE_PATH;
        path = (path == null) ? binaryFile.AFTER_PATH : path;
      } else if (patch instanceof ShelvedChange) {
        final ShelvedChange shelvedChange = (ShelvedChange)patch;
        path = shelvedChange.getBeforePath().replace('/', File.separatorChar);
      }
      if (path == null) {
        return null;
      }
      final int pos = path.lastIndexOf(File.separatorChar);
      return (pos >= 0) ? path.substring(pos + 1) : path;
    }
  }

  private static class ShelfTreeCellRenderer extends ColoredTreeCellRenderer {
    private final IssueLinkRenderer myIssueLinkRenderer;
    private final Map<Couple<String>, String> myMoveRenameInfo;
    private static final Icon PatchIcon = StdFileTypes.PATCH.getIcon();
    private static final Icon AppliedPatchIcon =
      new IconSizeWrapper(Patch_applied, Patch_applied.getIconWidth(), Patch_applied.getIconHeight()) {
        @Override
        public void paintIcon(Component c, Graphics g, int x, int y) {
          GraphicsUtil.paintWithAlpha(g, 0.6f);
          super.paintIcon(c, g, x, y);
        }
      };
    private static final Icon DisabledToDeleteIcon = IconUtil.desaturate(AllIcons.Actions.GC);

    public ShelfTreeCellRenderer(Project project, final Map<Couple<String>, String> moveRenameInfo) {
      myMoveRenameInfo = moveRenameInfo;
      myIssueLinkRenderer = new IssueLinkRenderer(project, this);
    }

    @Override
    public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
      DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
      Object nodeValue = node.getUserObject();
      if (nodeValue instanceof ShelvedChangeList) {
        ShelvedChangeList changeListData = (ShelvedChangeList) nodeValue;
        if (changeListData.isRecycled()) {
          myIssueLinkRenderer.appendTextWithLinks(changeListData.DESCRIPTION, SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES);
          setIcon(changeListData.isMarkedToDelete() ? DisabledToDeleteIcon : AppliedPatchIcon);
        }
        else {
          myIssueLinkRenderer.appendTextWithLinks(changeListData.DESCRIPTION);
          setIcon(PatchIcon);
        }
        int count = node.getChildCount();
        String numFilesText = spaceAndThinSpace() + count + " " + StringUtil.pluralize("file", count) + ",";
        append(numFilesText, SimpleTextAttributes.GRAYED_ATTRIBUTES);

        String date = DateFormatUtil.formatPrettyDateTime(changeListData.DATE);
        append(" " + date, SimpleTextAttributes.GRAYED_ATTRIBUTES);
      }
      else if (nodeValue instanceof ShelvedChange) {
        ShelvedChange change = (ShelvedChange) nodeValue;
        final String movedMessage = myMoveRenameInfo.get(Couple.of(change.getBeforePath(), change.getAfterPath()));
        renderFileName(change.getBeforePath(), change.getFileStatus(), movedMessage);
      }
      else if (nodeValue instanceof ShelvedBinaryFile) {
        ShelvedBinaryFile binaryFile = (ShelvedBinaryFile) nodeValue;
        String path = binaryFile.BEFORE_PATH;
        if (path == null) {
          path = binaryFile.AFTER_PATH;
        }
        final String movedMessage = myMoveRenameInfo.get(Couple.of(binaryFile.BEFORE_PATH, binaryFile.AFTER_PATH));
        renderFileName(path, binaryFile.getFileStatus(), movedMessage);
      }
    }

    private void renderFileName(String path, final FileStatus fileStatus, final String movedMessage) {
      path = path.replace('/', File.separatorChar);
      int pos = path.lastIndexOf(File.separatorChar);
      String fileName;
      String directory;
      if (pos >= 0) {
        directory = path.substring(0, pos).replace(File.separatorChar, File.separatorChar);
        fileName = path.substring(pos+1);
      }
      else {
        directory = "<project root>";
        fileName = path;
      }
      append(fileName, new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, fileStatus.getColor()));
      if (movedMessage != null) {
        append(movedMessage, SimpleTextAttributes.REGULAR_ATTRIBUTES);
      }
      append(spaceAndThinSpace() + directory, SimpleTextAttributes.GRAYED_ATTRIBUTES);
      setIcon(FileTypeManager.getInstance().getFileTypeByFileName(fileName).getIcon());
    }
  }

  private class MyShelveDeleteProvider implements DeleteProvider {

    @Override
    public void deleteElement(@NotNull DataContext dataContext) {
      final Project project = CommonDataKeys.PROJECT.getData(dataContext);
      if (project == null) return;

      List<ShelvedChangeList> shelvedListsToDelete = TreeUtil.collectSelectedObjectsOfType(myTree, ShelvedChangeList.class);
      ArrayList<ShelvedChangeList> shelvedListsFromChanges = ContainerUtil.newArrayList(getShelvedLists(dataContext));
      // filter changes
      shelvedListsFromChanges.removeAll(shelvedListsToDelete);
      List<ShelvedChange> changesToDelete = getChangesNotInLists(shelvedListsToDelete, getShelveChanges(dataContext));
      List<ShelvedBinaryFile> binariesToDelete = getBinariesNotInLists(shelvedListsToDelete, getBinaryShelveChanges(dataContext));

      int changeListSize = shelvedListsToDelete.size();
      int fileListSize = binariesToDelete.size() + changesToDelete.size();
      if (fileListSize == 0 && changeListSize == 0) return;

      String message = VcsBundle.message("shelve.changes.delete.items.confirm", constructDeleteFilesInfoMessage(fileListSize),
                                         changeListSize != 0 && fileListSize != 0 ? " and " : "",
                                         constructShelvedListInfoMessage(changeListSize, ContainerUtil.getFirstItem(shelvedListsToDelete)));
      int rc = Messages
        .showOkCancelDialog(myProject, message, VcsBundle.message("shelvedChanges.delete.title"), CommonBundle.message("button.delete"),
                            CommonBundle.getCancelButtonText(), Messages.getWarningIcon());
      if (rc != Messages.OK) return;
      for (ShelvedChangeList changeList : shelvedListsToDelete) {
        ShelveChangesManager.getInstance(myProject).deleteChangeList(changeList);
      }
      for (ShelvedChangeList list : shelvedListsFromChanges) {
        removeChangesFromChangeList(project, list, changesToDelete, binariesToDelete);
      }
    }

    private List<ShelvedBinaryFile> getBinariesNotInLists(@NotNull List<ShelvedChangeList> listsToDelete,
                                                          @NotNull List<ShelvedBinaryFile> binaryFiles) {
      List<ShelvedBinaryFile> result = new ArrayList<>(binaryFiles);
      for (ShelvedChangeList list : listsToDelete) {
        result.removeAll(list.getBinaryFiles());
      }
      return result;
    }

    @NotNull
    private List<ShelvedChange> getChangesNotInLists(@NotNull List<ShelvedChangeList> listsToDelete,
                                                     @NotNull List<ShelvedChange> shelvedChanges) {
      List<ShelvedChange> result = new ArrayList<>(shelvedChanges);
      for (ShelvedChangeList list : listsToDelete) {
        result.removeAll(list.getChanges(myProject));
      }
      return result;
    }

    @NotNull
    private String constructShelvedListInfoMessage(int size, @Nullable ShelvedChangeList first) {
      if (size == 0) return "";
      String message;
      if (size == 1 && first != null) {
        message = "<b> one shelved changelist</b> named [<b>" + first.DESCRIPTION + "</b>]";
      }
      else {
        message = "<b>" + size + " shelved " + StringUtil.pluralize("changelist", size) + "</b>";
      }
      return message + " with all changes inside";
    }

    @NotNull
    private String constructDeleteFilesInfoMessage(int size) {
      if (size == 0) return "";
      return "<b>" + (size == 1 ? "one" : size) + StringUtil.pluralize(" file", size) + "</b>";
    }

    private void removeChangesFromChangeList(@NotNull Project project,
                                             @NotNull ShelvedChangeList list,
                                             @NotNull List<ShelvedChange> changes,
                                             @NotNull List<ShelvedBinaryFile> binaryFiles) {
      final ArrayList<ShelvedBinaryFile> oldBinaries = new ArrayList<>(list.getBinaryFiles());
      final ArrayList<ShelvedChange> oldChanges = new ArrayList<>(list.getChanges(project));

      oldBinaries.removeAll(binaryFiles);
      oldChanges.removeAll(changes);

      final CommitContext commitContext = new CommitContext();
      final List<FilePatch> patches = new ArrayList<>();
      final List<VcsException> exceptions = new ArrayList<>();
      for (ShelvedChange change : oldChanges) {
        try {
          patches.add(change.loadFilePatch(myProject, commitContext));
        }
        catch (IOException | PatchSyntaxException e) {
          exceptions.add(new VcsException(e));
        }
      }

      myShelveChangesManager.saveRemainingPatches(list, patches, oldBinaries, commitContext);

      if (! exceptions.isEmpty()) {
        String title = list.DESCRIPTION == null ? "" : list.DESCRIPTION;
        title = title.substring(0, Math.min(10, title.length()));
        AbstractVcsHelper.getInstance(myProject).showErrors(exceptions, "Deleting files from '" + title + "'");
      }
    }

    @Override
    public boolean canDeleteElement(@NotNull DataContext dataContext) {
      return !getShelvedLists(dataContext).isEmpty();
    }
  }

  public class MyShelfContent extends DnDActivateOnHoldTargetContent {

    private MyShelfContent(JPanel panel, String displayName, boolean isLockable) {
      super(myProject, panel, displayName, isLockable);
    }

    @Override
    public void drop(DnDEvent event) {
      super.drop(event);
      Object attachedObject = event.getAttachedObject();
      if (attachedObject instanceof ChangeListDragBean) {
        FileDocumentManager.getInstance().saveAllDocuments();
        List<Change> changes = Arrays.asList(((ChangeListDragBean)attachedObject).getChanges());
        myShelveChangesManager.shelveSilentlyUnderProgress(changes);
      }
    }

    @Override
    public boolean isDropPossible(@NotNull DnDEvent event) {
      Object attachedObject = event.getAttachedObject();
      return attachedObject instanceof ChangeListDragBean && ((ChangeListDragBean)attachedObject).getChanges().length > 0;
    }
  }

  @Nullable
  private DnDDragStartBean createDragStartBean(@NotNull DnDActionInfo info) {
    if (info.isMove()) {
      DataContext dc = DataManager.getInstance().getDataContext(myTree);
      return new DnDDragStartBean(new ShelvedChangeListDragBean(getShelveChanges(dc), getBinaryShelveChanges(dc), getShelvedLists(dc)));
    }
    return null;
  }

  @NotNull
  private DnDImage createDraggedImage(@NotNull DnDActionInfo info) {
    String imageText = "Unshelve changes";
    Image image = DnDAwareTree.getDragImage(myTree, imageText, null).getFirst();
    return new DnDImage(image, new Point(-image.getWidth(null), -image.getHeight(null)));
  }

  private class MyToggleDetailsAction extends ShowDiffPreviewAction {
    @Override
    public void setSelected(AnActionEvent e, boolean state) {
      mySplitterComponent.setDetailsOn(state);
      myVcsConfiguration.SHELVE_DETAILS_PREVIEW_SHOWN = state;
    }

    @Override
    public boolean isSelected(AnActionEvent e) {
      return myVcsConfiguration.SHELVE_DETAILS_PREVIEW_SHOWN;
    }
  }

  private class MyShelvedPreviewProcessor extends CacheDiffRequestProcessor<ShelvedWrapper> implements DiffPreviewUpdateProcessor {

    @NotNull private final DiffShelvedChangesActionProvider.PatchesPreloader myPreloader;
    @Nullable private ShelvedWrapper myCurrentShelvedElement;

    public MyShelvedPreviewProcessor(@NotNull Project project) {
      super(project);
      myPreloader = new DiffShelvedChangesActionProvider.PatchesPreloader(project);
      Disposer.register(project, this);
    }

    @NotNull
    @Override
    protected String getRequestName(@NotNull ShelvedWrapper provider) {
      return provider.getRequestName();
    }

    @Override
    protected ShelvedWrapper getCurrentRequestProvider() {
      return myCurrentShelvedElement;
    }

    @CalledInAwt
    @Override
    public void clear() {
      myCurrentShelvedElement = null;
      updateRequest();
    }

    @CalledInAwt
    public void refresh() {
      DataContext dc = DataManager.getInstance().getDataContext(myTree);
      List<ShelvedChange> selectedChanges = getShelveChanges(dc);
      List<ShelvedBinaryFile> selectedBinaryChanges = getBinaryShelveChanges(dc);

      if (selectedChanges.isEmpty() && selectedBinaryChanges.isEmpty()) {
        clear();
        return;
      }

      if (myCurrentShelvedElement != null) {
        if (keepBinarySelection(selectedBinaryChanges, myCurrentShelvedElement.getBinaryFile()) ||
            keepShelvedSelection(selectedChanges, myCurrentShelvedElement.getShelvedChange())) {
          dropCachesIfNeededAndUpdate(myCurrentShelvedElement);
          return;
        }
      }
      //getFirstSelected
      myCurrentShelvedElement = !selectedChanges.isEmpty()
                                ? new ShelvedWrapper(selectedChanges.get(0))
                                : new ShelvedWrapper(selectedBinaryChanges.get(0));
      dropCachesIfNeededAndUpdate(myCurrentShelvedElement);
    }

    private void dropCachesIfNeededAndUpdate(@NotNull ShelvedWrapper currentShelvedElement) {
      ShelvedChange shelvedChange = currentShelvedElement.getShelvedChange();
      boolean dropCaches = shelvedChange != null && myPreloader.isPatchFileChanged(shelvedChange.getPatchPath());
      if (dropCaches) {
        dropCaches();
      }
      updateRequest(dropCaches);
    }

    boolean keepShelvedSelection(@NotNull List<ShelvedChange> selectedChanges, @Nullable ShelvedChange currentShelvedChange) {
      return currentShelvedChange != null && selectedChanges.contains(currentShelvedChange);
    }

    boolean keepBinarySelection(@NotNull List<ShelvedBinaryFile> selectedBinaryChanges, @Nullable ShelvedBinaryFile currentBinary) {
      return currentBinary != null && selectedBinaryChanges.contains(currentBinary);
    }

    @NotNull
    @Override
    protected DiffRequest loadRequest(@NotNull ShelvedWrapper provider, @NotNull ProgressIndicator indicator)
      throws ProcessCanceledException, DiffRequestProducerException {
      try {
        ShelvedChange shelvedChange = provider.getShelvedChange();
        if (shelvedChange != null) {
          return new PatchDiffRequest(createAppliedTextPatch(myPreloader.getPatch(shelvedChange, null)));
        }

        DiffContentFactoryEx factory = DiffContentFactoryEx.getInstanceEx();
        ShelvedBinaryFile binaryFile = assertNotNull(provider.getBinaryFile());
        if (binaryFile.AFTER_PATH == null) {
          throw new DiffRequestProducerException("Content for '" + getRequestName(provider) + "' was removed");
        }
        byte[] binaryContent = binaryFile.createBinaryContentRevision(myProject).getBinaryContent();
        FileType fileType = VcsUtil.getFilePath(binaryFile.SHELVED_PATH).getFileType();
        return new SimpleDiffRequest(getRequestName(provider), factory.createEmpty(),
                                     factory.createBinary(myProject, binaryContent, fileType, getRequestName(provider)), null, null);
      }
      catch (VcsException | IOException e) {
        throw new DiffRequestProducerException("Can't show diff for '" + getRequestName(provider) + "'", e);
      }
    }
  }

  private static class ShelvedListNode extends DefaultMutableTreeNode {
    @NotNull private final ShelvedChangeList myList;

    public ShelvedListNode(@NotNull ShelvedChangeList list) {
      super(list);
      myList = list;
    }

    @NotNull
    public ShelvedChangeList getList() {
      return myList;
    }
  }

  private class MyContentUpdater extends Update {
    public MyContentUpdater() {
      super("ShelfContentUpdate");
    }

    @Override
    public void run() {
      updateChangesContent();
    }

    @Override
    public boolean canEat(Update update) {
      return true;
    }
  }
}


text:
package org.phenoscape.owl.util

import org.semanticweb.owlapi.model.{IRI, OWLOntologyIRIMapper}

object NullIRIMapper extends OWLOntologyIRIMapper {

  override def getDocumentIRI(iri: IRI): IRI = null

}


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var MenuButtonRole = {
  relatedConcepts: [],
  type: 'widget'
};
var _default = MenuButtonRole;
exports["default"] = _default;


text:
package de.netpioneer.socialmedia.twitter.persistence;

import java.io.IOException;
import java.util.List;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Repository;

import de.netpioneer.socialmedia.core.util.FileUtilities;

@Repository
public class TwitterStopwordRepository {

	@Value("classpath:twitter-stopwords.txt")
	private Resource stopwordsResource;

	private List<String> stopwords;

	@PostConstruct
	public void init() throws IOException {
		stopwords = FileUtilities.readLines(stopwordsResource.getFile());
	}

	public List<String> getStopwords() {
		return stopwords;
	}

}


text:
#include "layouts/SequentialLayoutStyle.h"

namespace Visualization {

SequentialLayoutStyle::~SequentialLayoutStyle(){}

}


text:
package org.sql4j;

/**
 *
 * @author George Aristy
 */
public class Sql4JException extends Exception {
  Sql4JException(String message) {
    super(message);
  }

  Sql4JException(String message, Throwable cause) {
    super(message, cause);
  }
}


text:
{
'!langcode!': 'en-us',
'!langname!': 'English (US)',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN',
'"User Exception" debug mode. ': '"User Exception" debug mode. ',
'%s': '%s',
'%s %%{row} deleted': '%s %%{row} deleted',
'%s %%{row} updated': '%s %%{row} updated',
'%s selected': '%s selected',
'%s students registered': '%s students registered',
'%Y-%m-%d': '%Y-%m-%d',
'%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S',
'(requires internet access, experimental)': '(requires internet access, experimental)',
'(something like "it-it")': '(something like "it-it")',
'(version %s)': '(version %s)',
'?': '?',
'Abort': 'Abort',
'About': 'About',
'About application': 'About application',
'Accept Terms': 'Accept Terms',
'Add breakpoint': 'Add breakpoint',
'Additional code for your application': 'Additional code for your application',
'Admin design page': 'Admin design page',
'admin disabled because no admin password': 'admin disabled because no admin password',
'admin disabled because not supported on google app engine': 'admin disabled because not supported on google app engine',
'admin disabled because too many invalid login attempts': 'admin disabled because too many invalid login attempts',
'admin disabled because unable to access password file': 'admin disabled because unable to access password file',
'Admin is disabled because insecure channel': 'Admin is disabled because insecure channel',
'Admin language': 'Admin language',
'Admin versioning page': 'Admin versioning page',
'administrative interface': 'administrative interface',
'Administrator Password:': 'Administrator Password:',
'and rename it:': 'and rename it:',
'App does not exist or you are not authorized': 'App does not exist or you are not authorized',
'appadmin': 'appadmin',
'appadmin is disabled because insecure channel': 'appadmin is disabled because insecure channel',
'Application': 'Application',
'application "%s" uninstalled': 'application "%s" uninstalled',
'Application cannot be generated in demo mode': 'Application cannot be generated in demo mode',
'application compiled': 'application compiled',
'Application exists already': 'Application exists already',
'application is compiled and cannot be designed': 'application is compiled and cannot be designed',
'Application name:': 'Application name:',
'Application updated via git pull': 'Application updated via git pull',
'are not used': 'are not used',
'are not used yet': 'are not used yet',
'Are you sure you want to delete file "%s"?': 'Are you sure you want to delete file "%s"?',
'Are you sure you want to delete plugin "%s"?': 'Are you sure you want to delete plugin "%s"?',
'Are you sure you want to delete this object?': 'Are you sure you want to delete this object?',
'Are you sure you want to uninstall application "%s"?': 'Are you sure you want to uninstall application "%s"?',
'Are you sure?': 'Are you sure?',
'arguments': 'arguments',
'at char %s': 'at char %s',
'at line %s': 'at line %s',
'ATTENTION:': 'ATTENTION:',
'ATTENTION: Login requires a secure (HTTPS) connection or running on localhost.': 'ATTENTION: Login requires a secure (HTTPS) connection or running on localhost.',
'ATTENTION: TESTING IS NOT THREAD SAFE SO DO NOT PERFORM MULTIPLE TESTS CONCURRENTLY.': 'ATTENTION: TESTING IS NOT THREAD SAFE SO DO NOT PERFORM MULTIPLE TESTS CONCURRENTLY.',
'ATTENTION: you cannot edit the running application!': 'ATTENTION: you cannot edit the running application!',
'Autocomplete Python Code': 'Autocomplete Python Code',
'Available Databases and Tables': 'Available Databases and Tables',
'back': 'back',
'Back to the plugins list': 'Back to the plugins list',
'Back to wizard': 'Back to wizard',
'Basics': 'Basics',
'Begin': 'Begin',
'breakpoint': 'breakpoint',
'Breakpoints': 'Breakpoints',
'breakpoints': 'breakpoints',
'Bulk Register': 'Bulk Register',
'Bulk Student Registration': 'Bulk Student Registration',
'Cache': 'Cache',
'cache': 'cache',
'Cache Cleared': 'Cache Cleared',
'Cache Keys': 'Cache Keys',
'cache, errors and sessions cleaned': 'cache, errors and sessions cleaned',
'can be a git repo': 'can be a git repo',
'Cancel': 'Cancel',
'Cannot be empty': 'Cannot be empty',
'Cannot compile: there are errors in your app:': 'Cannot compile: there are errors in your app:',
'cannot create file': 'cannot create file',
'cannot upload file "%(filename)s"': 'cannot upload file "%(filename)s"',
'Change Admin Password': 'Change Admin Password',
'Change admin password': 'Change admin password',
'change editor settings': 'change editor settings',
'Changelog': 'Changelog',
'check all': 'check all',
'Check for upgrades': 'Check for upgrades',
'Check to delete': 'Check to delete',
'Checking for upgrades...': 'Checking for upgrades...',
'Clean': 'Clean',
'Clear': 'Clear',
'Clear CACHE?': 'Clear CACHE?',
'Clear DISK': 'Clear DISK',
'Clear RAM': 'Clear RAM',
'Click row to expand traceback': 'Click row to expand traceback',
'Click row to view a ticket': 'Click row to view a ticket',
'code': 'code',
'Code listing': 'Code listing',
'collapse/expand all': 'collapse/expand all',
'Command': 'Command',
'Comment:': 'Comment:',
'Commit': 'Commit',
'Commit form': 'Commit form',
'Committed files': 'Committed files',
'Compile': 'Compile',
'Compile (all or nothing)': 'Compile (all or nothing)',
'Compile (skip failed views)': 'Compile (skip failed views)',
'compiled application removed': 'compiled application removed',
'Condition': 'Condition',
'continue': 'continue',
'Controllers': 'Controllers',
'controllers': 'controllers',
'Count': 'Count',
'Create': 'Create',
'create file with filename:': 'create file with filename:',
'Create/Upload': 'Create/Upload',
'created by': 'created by',
'Created by:': 'Created by:',
'Created On': 'Created On',
'Created on:': 'Created on:',
'crontab': 'crontab',
'Current request': 'Current request',
'Current response': 'Current response',
'Current session': 'Current session',
'currently running': 'currently running',
'currently saved or': 'currently saved or',
'data uploaded': 'data uploaded',
'Database': 'Database',
'Database %s select': 'Database %s select',
'Database administration': 'Database administration',
'database administration': 'database administration',
'Database Administration (appadmin)': 'Database Administration (appadmin)',
'Date and Time': 'Date and Time',
'db': 'db',
'Debug': 'Debug',
'defines tables': 'defines tables',
'Delete': 'Delete',
'delete': 'delete',
'delete all checked': 'delete all checked',
'delete plugin': 'delete plugin',
'Delete this file (you will be asked to confirm deletion)': 'Delete this file (you will be asked to confirm deletion)',
'Delete:': 'Delete:',
'deleted after first hit': 'deleted after first hit',
'Demo': 'Demo',
'Deploy': 'Deploy',
'Deploy on Google App Engine': 'Deploy on Google App Engine',
'Deploy to OpenShift': 'Deploy to OpenShift',
'Deploy to pythonanywhere': 'Deploy to pythonanywhere',
'Deploy to PythonAnywhere': 'Deploy to PythonAnywhere',
'Deployment form': 'Deployment form',
'Deployment Interface': 'Deployment Interface',
'Description:': 'Description:',
'design': 'design',
'Detailed traceback description': 'Detailed traceback description',
'details': 'details',
'direction: ltr': 'direction: ltr',
'directory not found': 'directory not found',
'Disable': 'Disable',
'Disabled': 'Disabled',
'disabled in demo mode': 'disabled in demo mode',
'disabled in GAE mode': 'disabled in GAE mode',
'disabled in multi user mode': 'disabled in multi user mode',
'DISK': 'DISK',
'Disk Cache Keys': 'Disk Cache Keys',
'Disk Cleared': 'Disk Cleared',
'Display line numbers': 'Display line numbers',
'DO NOT use the "Pack compiled" feature.': 'DO NOT use the "Pack compiled" feature.',
'docs': 'docs',
'Docs': 'Docs',
'done!': 'done!',
'Downgrade': 'Downgrade',
'Download .w2p': 'Download .w2p',
'Download as .exe': 'Download as .exe',
'download layouts': 'download layouts',
'Download layouts from repository': 'Download layouts from repository',
'download plugins': 'download plugins',
'Download plugins from repository': 'Download plugins from repository',
'Edit': 'Edit',
'edit all': 'edit all',
'Edit application': 'Edit application',
'edit controller:': 'edit controller:',
'Edit current record': 'Edit current record',
'edit views:': 'edit views:',
'Editing %s': 'Editing %s',
'Editing Language file': 'Editing Language file',
'Editing Plural Forms File': 'Editing Plural Forms File',
'Editor': 'Editor',
'Email Address': 'Email Address',
'Enable': 'Enable',
'Enable Close-Tag': 'Enable Close-Tag',
'Enable Code Folding': 'Enable Code Folding',
'Error': 'Error',
'Error logs for "%(app)s"': 'Error logs for "%(app)s"',
'Error snapshot': 'Error snapshot',
'Error ticket': 'Error ticket',
'Errors': 'Errors',
'Exception %(extype)s: %(exvalue)s': 'Exception %(extype)s: %(exvalue)s',
'Exception %s': 'Exception %s',
'Exception instance attributes': 'Exception instance attributes',
'Exit Fullscreen': 'Exit Fullscreen',
'Expand Abbreviation (html files only)': 'Expand Abbreviation (html files only)',
'export as csv file': 'export as csv file',
'Exports:': 'Exports:',
'exposes': 'exposes',
'exposes:': 'exposes:',
'extends': 'extends',
'failed to compile file because:': 'failed to compile file because:',
'failed to reload module because:': 'failed to reload module because:',
'File': 'File',
'file "%(filename)s" created': 'file "%(filename)s" created',
'file "%(filename)s" deleted': 'file "%(filename)s" deleted',
'file "%(filename)s" uploaded': 'file "%(filename)s" uploaded',
'file "%s" of %s restored': 'file "%s" of %s restored',
'file changed on disk': 'file changed on disk',
'file does not exist': 'file does not exist',
'file not found': 'file not found',
'file saved on %(time)s': 'file saved on %(time)s',
'file saved on %s': 'file saved on %s',
'filename': 'filename',
'Filename': 'Filename',
'Files added': 'Files added',
'filter': 'filter',
'Find Next': 'Find Next',
'Find Previous': 'Find Previous',
'Form has errors': 'Form has errors',
'Frames': 'Frames',
'Functions with no doctests will result in [passed] tests.': 'Functions with no doctests will result in [passed] tests.',
'GAE Email': 'GAE Email',
'GAE Output': 'GAE Output',
'GAE Password': 'GAE Password',
'Generate': 'Generate',
'Git Pull': 'Git Pull',
'Git Push': 'Git Push',
'Globals##debug': 'Globals##debug',
'go!': 'go!',
'Google App Engine Deployment Interface': 'Google App Engine Deployment Interface',
'Google Application Id': 'Google Application Id',
'Goto': 'Goto',
'Graph Model': 'Graph Model',
'graph model': 'graph model',
'Help': 'Help',
'here': 'here',
'Hide/Show Translated strings': 'Hide/Show Translated strings',
'Highlight current line': 'Highlight current line',
'Hits': 'Hits',
'Home': 'Home',
'honored only if the expression evaluates to true': 'honored only if the expression evaluates to true',
'If start the downgrade, be patient, it may take a while to rollback': 'If start the downgrade, be patient, it may take a while to rollback',
'If start the upgrade, be patient, it may take a while to download': 'If start the upgrade, be patient, it may take a while to download',
'If the report above contains a ticket number it indicates a failure in executing the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\n\t\tA green title indicates that all tests (if defined) passed. In this case test results are not shown.': 'If the report above contains a ticket number it indicates a failure in executing the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\n\t\tA green title indicates that all tests (if defined) passed. In this case test results are not shown.',
'If the report above contains a ticket number it indicates a failure in executing the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\nA green title indicates that all tests (if defined) passed. In this case test results are not shown.': 'If the report above contains a ticket number it indicates a failure in executing the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\nA green title indicates that all tests (if defined) passed. In this case test results are not shown.',
'if your application uses a database other than sqlite you will then have to configure its DAL in pythonanywhere.': 'if your application uses a database other than sqlite you will then have to configure its DAL in pythonanywhere.',
'import': 'import',
'Import/Export': 'Import/Export',
'In development, use the default Rocket webserver that is currently supported by this debugger.': 'In development, use the default Rocket webserver that is currently supported by this debugger.',
'includes': 'includes',
'Indent with tabs': 'Indent with tabs',
'inspect attributes': 'inspect attributes',
'Install': 'Install',
'Installation of %(plugin)s for %(app)s': 'Installation of %(plugin)s for %(app)s',
'Installed applications': 'Installed applications',
'Interaction at %s line %s': 'Interaction at %s line %s',
'Interactive console': 'Interactive console',
'internal error': 'internal error',
'internal error: %s': 'internal error: %s',
'Internal State': 'Internal State',
'Invalid action': 'Invalid action',
'Invalid application name': 'Invalid application name',
'invalid circular reference': 'invalid circular reference',
'Invalid git repository specified.': 'Invalid git repository specified.',
'invalid password': 'invalid password',
'invalid password.': 'invalid password.',
'Invalid Query': 'Invalid Query',
'invalid request': 'invalid request',
'Invalid request': 'Invalid request',
'invalid table names (auth_* tables already defined)': 'invalid table names (auth_* tables already defined)',
'invalid ticket': 'invalid ticket',
'Key': 'Key',
'Keyboard shortcuts': 'Keyboard shortcuts',
'kill process': 'kill process',
'language file "%(filename)s" created/updated': 'language file "%(filename)s" created/updated',
'Language files (static strings) updated': 'Language files (static strings) updated',
'languages': 'languages',
'Languages': 'Languages',
'Last Revision': 'Last Revision',
'Last saved on:': 'Last saved on:',
'License for': 'License for',
'License:': 'License:',
'Line Nr': 'Line Nr',
'Line number': 'Line number',
'lists by exception': 'lists by exception',
'lists by ticket': 'lists by ticket',
'Loading...': 'Loading...',
'Local Apps': 'Local Apps',
'locals': 'locals',
'Locals##debug': 'Locals##debug',
'Login': 'Login',
'Login successful': 'Login successful',
'Login to the Administrative Interface': 'Login to the Administrative Interface',
'Login/Register': 'Login/Register',
'Logout': 'Logout',
'lost password': 'lost password',
'Main Menu': 'Main Menu',
'Manage': 'Manage',
'Manage %(action)s': 'Manage %(action)s',
'Manage Access Control': 'Manage Access Control',
'Manage Admin Users/Students': 'Manage Admin Users/Students',
'Manage Cache': 'Manage Cache',
'Manage Students': 'Manage Students',
'Memberships': 'Memberships',
'merge': 'merge',
'Models': 'Models',
'models': 'models',
'Modified On': 'Modified On',
'Modules': 'Modules',
'modules': 'modules',
'Multi User Mode': 'Multi User Mode',
'new application "%s" created': 'new application "%s" created',
'new application "%s" imported': 'new application "%s" imported',
'New Application Wizard': 'New Application Wizard',
'New application wizard': 'New application wizard',
'new plugin installed': 'new plugin installed',
'New plugin installed: %s': 'New plugin installed: %s',
'New Record': 'New Record',
'new record inserted': 'new record inserted',
'New simple application': 'New simple application',
'next': 'next',
'next %s rows': 'next %s rows',
'NO': 'NO',
'no changes': 'no changes',
'No databases in this application': 'No databases in this application',
'No Interaction yet': 'No Interaction yet',
'no match': 'no match',
'no package selected': 'no package selected',
'no permission to uninstall "%s"': 'no permission to uninstall "%s"',
'Node:': 'Node:',
'Not Authorized': 'Not Authorized',
'Not supported': 'Not supported',
'Note: If you receive an error with github status code of 128, ensure the system and account you are deploying from has a cooresponding ssh key configured in the openshift account.': 'Note: If you receive an error with github status code of 128, ensure the system and account you are deploying from has a cooresponding ssh key configured in the openshift account.',
"On production, you'll have to configure your webserver to use one process and multiple threads to use this debugger.": "On production, you'll have to configure your webserver to use one process and multiple threads to use this debugger.",
'Open new app in new window': 'Open new app in new window',
'OpenShift Deployment Interface': 'OpenShift Deployment Interface',
'OpenShift Output': 'OpenShift Output',
'or alternatively': 'or alternatively',
'Or Get from URL:': 'Or Get from URL:',
'or import from csv file': 'or import from csv file',
'Original/Translation': 'Original/Translation',
'Overview': 'Overview',
'Overwrite installed app': 'Overwrite installed app',
'Pack all': 'Pack all',
'Pack compiled': 'Pack compiled',
'Pack custom': 'Pack custom',
'pack plugin': 'pack plugin',
'password changed': 'password changed',
'Past revisions': 'Past revisions',
'Path to appcfg.py': 'Path to appcfg.py',
'Path to local openshift repo root.': 'Path to local openshift repo root.',
'Peeking at file': 'Peeking at file',
'Permission': 'Permission',
'Permissions': 'Permissions',
'Please': 'Please',
'Please wait, giving pythonanywhere a moment...': 'Please wait, giving pythonanywhere a moment...',
'plugin "%(plugin)s" deleted': 'plugin "%(plugin)s" deleted',
'Plugin "%s" in application': 'Plugin "%s" in application',
'plugin not specified': 'plugin not specified',
'Plugin page': 'Plugin page',
'plugins': 'plugins',
'Plugins': 'Plugins',
'Plural Form #%s': 'Plural Form #%s',
'Plural-Forms:': 'Plural-Forms:',
'Powered by': 'Powered by',
'Preferences saved correctly': 'Preferences saved correctly',
'Preferences saved on session only': 'Preferences saved on session only',
'previous %s rows': 'previous %s rows',
'Private files': 'Private files',
'private files': 'private files',
'Project Progress': 'Project Progress',
'Pull': 'Pull',
'Pull failed, certain files could not be checked out. Check logs for details.': 'Pull failed, certain files could not be checked out. Check logs for details.',
'Pull is not possible because you have unmerged files. Fix them up in the work tree, and then try again.': 'Pull is not possible because you have unmerged files. Fix them up in the work tree, and then try again.',
'Push': 'Push',
'Push failed, there are unmerged entries in the cache. Resolve merge issues manually and try again.': 'Push failed, there are unmerged entries in the cache. Resolve merge issues manually and try again.',
'pygraphviz library not found': 'pygraphviz library not found',
'PythonAnywhere Apps': 'PythonAnywhere Apps',
'PythonAnywhere Password': 'PythonAnywhere Password',
'Query:': 'Query:',
'RAM': 'RAM',
'RAM Cache Keys': 'RAM Cache Keys',
'Ram Cleared': 'Ram Cleared',
'Rapid Search': 'Rapid Search',
'Record': 'Record',
'record does not exist': 'record does not exist',
'Record id': 'Record id',
'refresh': 'refresh',
'register': 'register',
'Reload routes': 'Reload routes',
'Remove compiled': 'Remove compiled',
'Removed Breakpoint on %s at line %s': 'Removed Breakpoint on %s at line %s',
'Replace': 'Replace',
'Replace All': 'Replace All',
'Repository (%s)': 'Repository (%s)',
'request': 'request',
'requires distutils, but not installed': 'requires distutils, but not installed',
'requires python-git, but not installed': 'requires python-git, but not installed',
'Resolve Conflict file': 'Resolve Conflict file',
'response': 'response',
'restart': 'restart',
'restore': 'restore',
'return': 'return',
'Revert': 'Revert',
'revert': 'revert',
'reverted to revision %s': 'reverted to revision %s',
'Revision %s': 'Revision %s',
'Revision:': 'Revision:',
'Role': 'Role',
'Roles': 'Roles',
'Rows in Table': 'Rows in Table',
'Rows selected': 'Rows selected',
'rules are not defined': 'rules are not defined',
'Run tests': 'Run tests',
'Run tests in this file': 'Run tests in this file',
"Run tests in this file (to run all files, you may also use the button labelled 'test')": "Run tests in this file (to run all files, you may also use the button labelled 'test')",
'Running on %s': 'Running on %s',
'Save': 'Save',
'Save file:': 'Save file:',
'Save file: %s': 'Save file: %s',
'Save model as...': 'Save model as...',
'Save via Ajax': 'Save via Ajax',
'Saved file hash:': 'Saved file hash:',
'Screenshot %s': 'Screenshot %s',
'Search': 'Search',
'Select Files to Package': 'Select Files to Package',
'session': 'session',
'session expired': 'session expired',
'Session saved correctly': 'Session saved correctly',
'Session saved on session only': 'Session saved on session only',
'Set Breakpoint on %s at line %s: %s': 'Set Breakpoint on %s at line %s: %s',
'shell': 'shell',
'Showing %s to %s of %s %s found': 'Showing %s to %s of %s %s found',
'Singular Form': 'Singular Form',
'Site': 'Site',
'Size of cache:': 'Size of cache:',
'skip to generate': 'skip to generate',
'some files could not be removed': 'some files could not be removed',
'Something went wrong please wait a few minutes before retrying': 'Something went wrong please wait a few minutes before retrying',
'Sorry, could not find mercurial installed': 'Sorry, could not find mercurial installed',
'source : db': 'source : db',
'source : filesystem': 'source : filesystem',
'Start a new app': 'Start a new app',
'Start searching': 'Start searching',
'Start wizard': 'Start wizard',
'state': 'state',
'static': 'static',
'Static': 'Static',
'Static files': 'Static files',
'Statistics': 'Statistics',
'Step': 'Step',
'step': 'step',
'stop': 'stop',
'Submit': 'Submit',
'submit': 'submit',
'successful': 'successful',
'switch to : db': 'switch to : db',
'switch to : filesystem': 'switch to : filesystem',
'Tab width (# characters)': 'Tab width (# characters)',
'Table': 'Table',
'Temporary': 'Temporary',
'test': 'test',
'Testing application': 'Testing application',
'The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.': 'The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.',
'The app exists, was created by wizard, continue to overwrite!': 'The app exists, was created by wizard, continue to overwrite!',
'The app exists, was NOT created by wizard, continue to overwrite!': 'The app exists, was NOT created by wizard, continue to overwrite!',
'The application logic, each URL path is mapped in one exposed function in the controller': 'The application logic, each URL path is mapped in one exposed function in the controller',
'The data representation, define database tables and sets': 'The data representation, define database tables and sets',
'The presentations layer, views are also known as templates': 'The presentations layer, views are also known as templates',
'Theme': 'Theme',
'There are no controllers': 'There are no controllers',
'There are no models': 'There are no models',
'There are no modules': 'There are no modules',
'There are no plugins': 'There are no plugins',
'There are no private files': 'There are no private files',
'There are no static files': 'There are no static files',
'There are no translators': 'There are no translators',
'There are no translators, only default language is supported': 'There are no translators, only default language is supported',
'There are no views': 'There are no views',
'These files are not served, they are only available from within your app': 'These files are not served, they are only available from within your app',
'These files are served without processing, your images go here': 'These files are served without processing, your images go here',
"This debugger may not work properly if you don't have a threaded webserver or you're using multiple daemon processes.": "This debugger may not work properly if you don't have a threaded webserver or you're using multiple daemon processes.",
'This is an experimental feature and it needs more testing. If you decide to downgrade you do it at your own risk': 'This is an experimental feature and it needs more testing. If you decide to downgrade you do it at your own risk',
'This is an experimental feature and it needs more testing. If you decide to upgrade you do it at your own risk': 'This is an experimental feature and it needs more testing. If you decide to upgrade you do it at your own risk',
"This page can commit your changes to an openshift app repo and push them to your cloud instance. This assumes that you've already created the application instance using the web2py skeleton and have that repo somewhere on a filesystem that this web2py instance can access. This functionality requires GitPython installed and on the python path of the runtime that web2py is operating in.": "This page can commit your changes to an openshift app repo and push them to your cloud instance. This assumes that you've already created the application instance using the web2py skeleton and have that repo somewhere on a filesystem that this web2py instance can access. This functionality requires GitPython installed and on the python path of the runtime that web2py is operating in.",
'This page can upload your application to the Google App Engine computing cloud. Mind that you must first create indexes locally and this is done by installing the Google appserver and running the app locally with it once, or there will be errors when selecting records. Attention: deployment may take long time, depending on the network speed. Attention: it will overwrite your app.yaml. DO NOT SUBMIT TWICE.': 'This page can upload your application to the Google App Engine computing cloud. Mind that you must first create indexes locally and this is done by installing the Google appserver and running the app locally with it once, or there will be errors when selecting records. Attention: deployment may take long time, depending on the network speed. Attention: it will overwrite your app.yaml. DO NOT SUBMIT TWICE.',
'this page to see if a breakpoint was hit and debug interaction is required.': 'this page to see if a breakpoint was hit and debug interaction is required.',
'This will pull changes from the remote repo for application "%s"?': 'This will pull changes from the remote repo for application "%s"?',
'This will push changes to the remote repo for application "%s".': 'This will push changes to the remote repo for application "%s".',
'Ticket': 'Ticket',
'Ticket ID': 'Ticket ID',
'Ticket Missing': 'Ticket Missing',
'Time in Cache (h:m:s)': 'Time in Cache (h:m:s)',
'to  previous version.': 'to  previous version.',
'To create a plugin, name a file/folder plugin_[name]': 'To create a plugin, name a file/folder plugin_[name]',
'To emulate a breakpoint programatically, write:': 'To emulate a breakpoint programatically, write:',
'to use the debugger!': 'to use the debugger!',
'toggle breakpoint': 'toggle breakpoint',
'Toggle comment': 'Toggle comment',
'Toggle Fullscreen': 'Toggle Fullscreen',
'Traceback': 'Traceback',
'Translation strings for the application': 'Translation strings for the application',
'try something like': 'try something like',
'Try the mobile interface': 'Try the mobile interface',
'try view': 'try view',
'Type PDB debugger command in here and hit Return (Enter) to execute it.': 'Type PDB debugger command in here and hit Return (Enter) to execute it.',
'Type some Python code in here and hit Return (Enter) to execute it.': 'Type some Python code in here and hit Return (Enter) to execute it.',
'Unable to check for upgrades': 'Unable to check for upgrades',
'unable to create application "%s"': 'unable to create application "%s"',
'unable to delete file "%(filename)s"': 'unable to delete file "%(filename)s"',
'unable to delete file plugin "%(plugin)s"': 'unable to delete file plugin "%(plugin)s"',
'Unable to determine the line number!': 'Unable to determine the line number!',
'Unable to download app because:': 'Unable to download app because:',
'unable to download layout': 'unable to download layout',
'unable to download plugin: %s': 'unable to download plugin: %s',
'Unable to download the list of plugins': 'Unable to download the list of plugins',
'unable to install plugin "%s"': 'unable to install plugin "%s"',
'unable to parse csv file': 'unable to parse csv file',
'unable to uninstall "%s"': 'unable to uninstall "%s"',
'unable to upgrade because "%s"': 'unable to upgrade because "%s"',
'uncheck all': 'uncheck all',
'Uninstall': 'Uninstall',
'Unsupported webserver working mode: %s': 'Unsupported webserver working mode: %s',
'update': 'update',
'update all languages': 'update all languages',
'Update:': 'Update:',
'Upgrade': 'Upgrade',
'upgrade now to %s': 'upgrade now to %s',
'upload': 'upload',
'Upload': 'Upload',
'Upload a package:': 'Upload a package:',
'Upload and install packed application': 'Upload and install packed application',
'upload file:': 'upload file:',
'upload plugin file:': 'upload plugin file:',
'Use (...)&(...) for AND, (...)|(...) for OR, and ~(...)  for NOT to build more complex queries.': 'Use (...)&(...) for AND, (...)|(...) for OR, and ~(...)  for NOT to build more complex queries.',
'User': 'User',
'Username': 'Username',
'Users': 'Users',
'Using the shell may lock the database to other users of this app.': 'Using the shell may lock the database to other users of this app.',
'variables': 'variables',
'Version': 'Version',
'Versioning': 'Versioning',
'Views': 'Views',
'views': 'views',
'Warning!': 'Warning!',
'WARNING:': 'WARNING:',
'WARNING: The following views could not be compiled:': 'WARNING: The following views could not be compiled:',
'Web Framework': 'Web Framework',
'web2py Admin Password': 'web2py Admin Password',
'web2py apps to deploy': 'web2py apps to deploy',
'web2py Debugger': 'web2py Debugger',
'web2py downgrade': 'web2py downgrade',
'web2py is up to date': 'web2py is up to date',
'web2py online debugger': 'web2py online debugger',
'web2py upgrade': 'web2py upgrade',
'web2py upgraded; please restart it': 'web2py upgraded; please restart it',
'Working...': 'Working...',
'WSGI reference name': 'WSGI reference name',
'YES': 'YES',
'Yes': 'Yes',
'You can also set and remove breakpoint in the edit window, using the Toggle Breakpoint button': 'You can also set and remove breakpoint in the edit window, using the Toggle Breakpoint button',
'You can inspect variables using the console below': 'You can inspect variables using the console below',
'You have one more login attempt before you are locked out': 'You have one more login attempt before you are locked out',
'You need to set up and reach a': 'You need to set up and reach a',
'You only need these if you have already registered': 'You only need these if you have already registered',
'Your application will be blocked until you click an action button (next, step, continue, etc.)': 'Your application will be blocked until you click an action button (next, step, continue, etc.)',
}