Ejemplo n.º 1
0
        internal void ScrollIndexIntoViewCore(ScrollIntoViewOperation <int> scrollOperation)
        {
            var update = new DelegateUpdate <UpdateFlags>(() =>
            {
                if (scrollOperation.ScrollAttempts < ScrollIntoViewOperation <int> .MaxScrollAttempts)
                {
                    if (this.IsIndexInView(scrollOperation))
                    {
                        if (scrollOperation.CompletedAction != null)
                        {
                            this.GridView.UpdateService.RegisterUpdate(new DelegateUpdate <UpdateFlags>(scrollOperation.CompletedAction));
                        }
                    }
                    else
                    {
                        this.ScrollIndexIntoView(scrollOperation);
                        scrollOperation.ScrollAttempts++;

                        this.ScrollIndexIntoViewCore(scrollOperation);
                    }
                }
            })
            {
                RequiresValidMeasure = true
            };

            this.GridView.UpdateService.RegisterUpdate(update);
        }
Ejemplo n.º 2
0
        internal void ScrollColumnIntoViewCore(ScrollIntoViewOperation <int> scrollOperation)
        {
            var update = new DelegateUpdate <UpdateFlags>(() =>
            {
                if (scrollOperation.ScrollAttempts < ScrollIntoViewOperation <int> .MaxScrollAttempts)
                {
                    this.ScrollColumnIndexIntoView(scrollOperation);
                    scrollOperation.ScrollAttempts++;

                    if (this.IsColumnIndexInView(scrollOperation))
                    {
                        if (scrollOperation.CompletedAction != null)
                        {
                            scrollOperation.CompletedAction();
                        }
                    }
                    else
                    {
                        this.ScrollColumnIntoViewCore(scrollOperation);
                    }
                }
            });

            this.GridView.UpdateService.RegisterUpdate(update);
        }
Ejemplo n.º 3
0
 public bool Update(
     IDataContext context,
     ActionPresentation presentation,
     DelegateUpdate nextUpdate)
 {
     return(true);
 }
Ejemplo n.º 4
0
        public override bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            string sessionId = GetSessionId(context);
            if (sessionId == null)
                return false;

            return SessionCache.HasSerializedReport(sessionId);
        }
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            // fetch active solution from context
            ISolution solution = context.GetData(ProjectModel.DataContext.DataConstants.SOLUTION);

            // enable this action if there is an active solution, disable otherwise
            return(solution != null);
        }
    bool IActionHandler.Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
    {
      // fetch focused text editor control
      ITextControl textControl = context.GetData(TextControl.DataContext.DataConstants.TEXT_CONTROL);

      // enable this action if we are in text editor, disable otherwise
      return textControl != null;
    }
    public virtual bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
    {
      // Check that we have a solution
      if (!context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION, TextControl.DataContext.DataConstants.TEXT_CONTROL))
        return false;

      return IsSupportedFile(GetProjectFile(context));
    }
    public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
    {
      // fetch active solution from context
      ISolution solution = context.GetData(ProjectModel.DataContext.DataConstants.SOLUTION);

      // enable this action if there is an active solution, disable otherwise
      return solution != null;
    }
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            var layers = context.GetData(DataConstants.SelectedUserFriendlySettingsLayers);
            if (layers == null || layers.IsEmpty())
                return false;

            // Action is disabled if *any* layers have reset blocked
            return layers.All(CanReset) && nextUpdate();
        }
Ejemplo n.º 10
0
        public PlayerPcm(MusicPcm aMusic)
        {
            synthesizer = new SynthesizerPcm(aMusic);
            bufferArray = new float[2];

            delegateUpdate = UpdatePlay;

            volume = 0.5f;
        }
Ejemplo n.º 11
0
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            var solution = context.GetData(DataConstants.SOLUTION);
            var isUpdate = (solution != null);

            presentation.Visible = isUpdate;

            return(isUpdate);
        }
Ejemplo n.º 12
0
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            bool update = nextUpdate();

            if (!IsAvailable(context))
            {
                return(update);
            }
            return(true);
        }
        public virtual bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            // Check that we have a solution
              if (!context.CheckAllNotNull(IDE.DataConstants.SOLUTION, IDE.DataConstants.TEXT_CONTROL))
              {
            return nextUpdate();
              }

              return IsSupportedFile(GetProjectFile(context)) || nextUpdate();
        }
Ejemplo n.º 14
0
 public void Pause()
 {
     if (delegateUpdate == UpdatePlay)
     {
         delegateUpdate = UpdateSynth;
     }
     else
     {
         delegateUpdate = UpdatePlay;
     }
 }
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            // this allows double [Shift+Alt+L] to work even when there is no project file context
            // available (for example, when 'References' project node is focused in Solution Explorer)
            // and builtin 'LocateInSolutionExplorer' action is not normally available
            lastUnderlyingActionUpdate = nextUpdate();

            // and it's better to do this:
            var locateFileAction = actionManager.TryGetAction(LocateFileAction.Id) as IUpdatableAction;
            return locateFileAction == null || locateFileAction.Update(context);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Updates action visual presentation. If presentation.Enabled is set to false, Execute
        ///             will not be called.
        /// </summary>
        /// <param name="context">DataContext</param><param name="presentation">presentation to update</param><param name="nextUpdate">delegate to call</param>
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            var solution = context.GetData(DataConstants.SOLUTION);
            bool visible = solution != null;

            if (!visible)
            {
                presentation.Visible = false;
            }

            return visible;
        }
Ejemplo n.º 17
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     if (GetProjectFile(context) == null)
     {
         return(nextUpdate());
     }
     if (context.GetData(ProjectModelDataConstants.SOLUTION) == null)
     {
         return(nextUpdate());
     }
     return(true);
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Updates action visual presentation. If presentation.Enabled is set to false, Execute
        ///             will not be called.
        /// </summary>
        /// <param name="context">DataContext</param><param name="presentation">presentation to update</param><param name="nextUpdate">delegate to call</param>
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            var  solution = context.GetData(DataConstants.SOLUTION);
            bool visible  = solution != null;

            if (!visible)
            {
                presentation.Visible = false;
            }

            return(visible);
        }
Ejemplo n.º 19
0
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            var layers = context.GetData(DataConstants.SelectedUserFriendlySettingsLayers);

            if (layers == null || layers.IsEmpty())
            {
                return(false);
            }

            // Action is disabled if *any* layers have reset blocked
            return(layers.All(CanReset) && nextUpdate());
        }
Ejemplo n.º 20
0
        public PlayerPcm(string aFilePath, MusicPcm aMusic)
        {
            FilePath    = aFilePath;
            music       = aMusic;
            synthesizer = new SynthesizerPcm(music.Waveform, music.Loop);
            bufferArray = new float[2];

            delegateUpdate = UpdatePlay;

            Volume = 0.5f;
            IsMute = false;
            IsLoop = true;
        }
Ejemplo n.º 21
0
      public bool Update(IDataContext dataContext, ActionPresentation presentation, DelegateUpdate nextUpdate)
      {
        var solution = dataContext.GetData(JetBrains.ProjectModel.DataContext.DataConstants.SOLUTION);
        if (solution == null)
          return nextUpdate();

        var textControl = dataContext.GetData(JetBrains.TextControl.DataContext.DataConstants.TEXT_CONTROL);
        if (textControl == null)
          return nextUpdate();

        var doc = dataContext.GetData(JetBrains.DocumentModel.DataConstants.DOCUMENT);
        if (doc == null)
          return nextUpdate();

        return true;
      }
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            if (context.GetData(JetBrains.UI.DataConstants.PopupWindowContextSource) == null)
            {
                return(false);
            }

            var menuActionGroup = GetMenuActionGroup();

            if (menuActionGroup == null)
            {
                return(false);
            }

            return(menuActionGroup.MenuChildren.OfType <IActionDefWithId>().Any(executableAction => actionManager.Handlers.Evaluate(executableAction, context).IsAvailable));
        }
Ejemplo n.º 23
0
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            var solution = FindSolution(context);

            if (solution == null)
            {
                return(false);
            }
            var psiSourceFile = context.GetData(PsiDataConstants.SOURCE_FILE);

            if (psiSourceFile == null)
            {
                return(false);
            }
            return(DoUpdate(psiSourceFile, solution));
        }
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            // action is in context menu, so it is updated only once when menu is shown
              var solution = context.GetData(DataConstants.SOLUTION);
              var elements = context.GetData(UnitTestDataConstants.UNIT_TEST_ELEMENTS);
              if (solution == null || elements == null || elements.ExplicitElements.IsEmpty())
              {
            presentation.Visible = false;
            return false;
              }

              var element = elements.ExplicitElements.First();
              var result = solution.GetComponent<IUnitTestResultManager>().GetResult(element);

              // show correct action depending on test status
              switch (result.Status)
              {
            case UnitTestStatus.Success:
            case UnitTestStatus.Ignored:
              if (element.Explicit)
              {
            presentation.Text = "Unignore test";
            presentation.Visible = true;
              }
              else
            presentation.Visible = false;
              break;
            case UnitTestStatus.Failed:
            case UnitTestStatus.Aborted:
              if (!element.Explicit)
              {
            presentation.Text = "Ignore test";
            presentation.Visible = true;
              }
              else
            presentation.Visible = false;
              break;
            default:
              presentation.Visible = false;
              return false;
              }

              return true;
        }
Ejemplo n.º 25
0
        public void updateStatusBar(long bytes, string msg)
        {
            if (InvokeRequired)
            {
                var d = new DelegateUpdate(updateStatusBar);
                BeginInvoke(d, new object[] { bytes, msg });
            }
            else
            {
                if (bytes > 0)
                {
                    progressBar.Visible = true;
                    lblProgress.Visible = true;
                }

                progressBar.Value    = (int)bytes;
                lblProgress.Text     = msg;
                lblProgress.Location = new Point(this.ClientRectangle.Width - lblProgress.Width - progressBar.Width - 34, 385);
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// 最后清理.</summary>
        public void Cleanup()
        {
            _luaInit         = null;
            _luaRecycle      = null;
            _luaOpen         = null;
            _luaClose        = null;
            _luaUpdate       = null;
            _luaPause        = null;
            _luaResume       = null;
            _luaCover        = null;
            _luaReveal       = null;
            _luaRefocus      = null;
            _luaDepthChanged = null;

            _workerTable = null;

            if (_scriptEnv != null)
            {
                _scriptEnv.Dispose();
            }
            _scriptEnv = null;
        }
Ejemplo n.º 27
0
 public void Stop()
 {
     delegateUpdate = UpdateSynth;
 }
Ejemplo n.º 28
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
   return
     context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION, ProjectModel.DataContext.DataConstants.PROJECT_MODEL_ELEMENTS) ||
     context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION, DataConstants.DOCUMENT_SELECTION);
 }
Ejemplo n.º 29
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 30
0
        public override bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            string sessionId = GetSessionId(context);

            if (sessionId == null)
            {
                return(false);
            }

            return(SessionCache.HasSerializedReport(sessionId));
        }
Ejemplo n.º 31
0
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            var solution = context.GetData(ProjectModelDataConstants.SOLUTION);

            return(solution != null);
        }
            public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
            {
                var solution = context.GetData(ProjectModel.DataContext.DataConstants.SOLUTION);
                var textControl = context.GetData(TextControl.DataContext.DataConstants.TEXT_CONTROL);
                if (textControl != null && solution != null)
                {
                  var sourceFile = textControl.Document.GetPsiSourceFile(solution);
                  if (sourceFile != null)
                  {
                var template = GetTemplateFromTextControl(textControl, solution);
                if (template != null) return true;
                  }
                }

                return nextUpdate();
            }
Ejemplo n.º 33
0
 public abstract bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate);
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     var checkAllNotNull = context.CheckAllNotNull(DataConstants.SOLUTION);
     return checkAllNotNull;
 }
Ejemplo n.º 35
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return
         (context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION, ProjectModel.DataContext.DataConstants.PROJECT_MODEL_ELEMENTS) ||
          context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION, DataConstants.DOCUMENT_SELECTION));
 }
Ejemplo n.º 36
0
 bool IExecutableAction.Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 => true;
        bool IActionHandler.Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            // fetch focused text editor control
            ITextControl textControl = context.GetData(TextControl.DataContext.DataConstants.TEXT_CONTROL);

            // enable this action if we are in text editor, disable otherwise
            return(textControl != null);
        }
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     // It's always allowed. We don't need a solution present
     return context.CheckAllNotNull(JetBrains.ProjectModel.DataContext.DataConstants.SOLUTION);
 }
Ejemplo n.º 39
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     // return true or false to enable/disable this action
     return(true);
 }
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return context.GetData<ISolution>(JetBrains.ProjectModel.DataContext.DataConstants.SOLUTION) != null;
 }
Ejemplo n.º 41
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return true;
 }
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return context.CheckAllNotNull(ProjectModelConstants.SOLUTION);
 }
Ejemplo n.º 43
0
 /// <summary>
 /// Updates action visual presentation. If presentation.Enabled is set to false, Execute
 /// will not be called.
 /// </summary>
 /// <param name="context">DataContext</param>
 /// <param name="presentation">presentation to update</param>
 /// <param name="nextUpdate">delegate to call</param>
 bool IActionHandler.Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return Update(context);
 }
        public bool Update(
            IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            var solution = context.GetData(ProjectModel.DataContext.DataConstants.SOLUTION);
              var isUpdate = (solution != null);

              presentation.Visible = isUpdate;

              return isUpdate;
        }
 /// <summary>
 /// Updates action visual presentation. If presentation.Enabled is set to false, Execute
 /// will not be called.
 /// </summary>
 /// <param name="context">The DataContext</param>
 /// <param name="presentation">presentation to update</param>
 /// <param name="nextUpdate">delegate to call</param>
 /// <returns>The update result.</returns>
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
   var solution = context.GetData(JetBrains.ProjectModel.DataContext.DataConstants.SOLUTION);
   return solution != null;
 }
Ejemplo n.º 46
0
 public bool Update(IDataContext context, ActionPresentation presentation, [CanBeNull] DelegateUpdate nextUpdate)
 {
     return(DebuggingControlIni.GetModulePathsWithDebuggingControlIni(GetSelectedModulePaths()).Any());
 }
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     // return true or false to enable/disable this action
       return true;
 }
Ejemplo n.º 48
0
        public virtual bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            // Check that we have a solution
            if (!context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION, TextControl.DataContext.DataConstants.TEXT_CONTROL))
            {
                return(false);
            }

            return(IsSupportedFile(GetProjectFile(context)));
        }
Ejemplo n.º 49
0
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            // Better to check everything now and then work with valid data.

            ITextControl textControl = context.GetData(TextControlDataConstants.TEXT_CONTROL);

            if (textControl == null)
            {
                return(false);
            }

            if (textControl.IsReadOnly)
            {
                return(false);
            }

            if (textControl.Selection.IsDisjoint())
            {
                return(false);
            }

            IEquatableList <TextControlPosRange> equatableList = textControl.Selection.Ranges.Value;

            if (equatableList.Count > 1)
            {
                return(false);
            }

            ISolution solution = context.GetData(ProjectModelDataConstants.SOLUTION);

            if (solution == null)
            {
                return(false);
            }

            IPsiSourceFile psiSourceFile = textControl.Document.GetPsiSourceFile(solution);

            if (psiSourceFile == null)
            {
                return(false);
            }

            if (!psiSourceFile.IsValid())
            {
                return(false);
            }

            TextRange textRange =
                equatableList.Count == 1 ? equatableList[0].ToDocRangeNormalized() : new TextRange(textControl.Caret.Offset());
            DocumentRange range   = new DocumentRange(textControl.Document, textRange);
            ICSharpFile   psiFile = psiSourceFile.GetPsiFile <CSharpLanguage>(range) as ICSharpFile;

            if (psiFile == null)
            {
                return(false);
            }

            if (!psiFile.IsValid())
            {
                return(false);
            }

            if (context.GetData(UIDataConstants.PopupWindowContextSource) == null)
            {
                return(false);
            }

            return(true);
        }
        bool IExecutableAction.Update(IDataContext dataContext, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            var collector = CodeCleanupFilesCollector.TryCreate(dataContext);

            if (collector == null)
            {
                return(false);
            }

            var psiServices = collector.Solution.GetPsiServices();

            if (!psiServices.Files.AllDocumentsAreCommitted || !psiServices.CachesState.IsInitialUpdateFinished.Value)
            {
                return(false);
            }

            switch (collector.GetActionScope())
            {
            case ActionScope.None:
            case ActionScope.Selection:
            case ActionScope.File:
                return(false);

            case ActionScope.MultipleFiles:
            case ActionScope.Solution:
            case ActionScope.Directory:
                return(true);
            }

            return(false);
        }
Ejemplo n.º 51
0
 ///<summary>
 ///
 ///            Updates action visual presentation. If presentation.Enabled is set to false, Execute
 ///            will not be called.
 ///            
 ///</summary>
 ///
 ///<param name="context">DataContext</param>
 ///<param name="presentation">presentation to update</param>
 ///<param name="nextUpdate">delegate to call</param>
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return (new DeleteUnusedReferencesWorkflow()).IsAvailable(context);
 }
Ejemplo n.º 52
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
   // Check that we have a solution
   return context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION);
 }
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     // action is in context menu, so it is updated only once when menu is shown
       var elements = context.GetData(UnitTestDataConstants.UNIT_TEST_ELEMENTS);
       return elements != null && elements.ExplicitElements.Any();
 }
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     ISolution solution;
     return TryGetExistingAssemblyFile(context, out solution) != null;
 }
Ejemplo n.º 55
0
 ///<summary>
 ///
 ///            Updates action visual presentation. If presentation.Enabled is set to false, Execute
 ///            will not be called.
 ///            
 ///</summary>
 ///
 ///<param name="context">DataContext</param>
 ///<param name="presentation">presentation to update</param>
 ///<param name="nextUpdate">delegate to call</param>
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     IClass @class =
         context.GetData<IDeclaredElement>(JetBrains.ReSharper.DataConstants.DECLARED_ELEMENT) as IClass;
     return @class != null && ExistsSerializableAttribute(@class);
 }
Ejemplo n.º 56
0
 public void UpdateBegin(string sKey, TaskResultDataToUpdate oTast, AsyncCallback fCallback, object oParam)
 {
     m_oUpdate = Update;
     m_oUpdate.BeginInvoke(sKey, oTast, fCallback, oParam);
 }
        /// <summary>
        /// Updates action visual presentation. If presentation.Enabled is set to <c>false</c>, Execute
        /// will not be called.
        /// </summary>
        /// <param name="context">The data context.</param>
        /// <param name="presentation">presentation to update</param>
        /// <param name="nextUpdate">delegate to call</param>
        /// <returns><c>true</c>, if successful.</returns>
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            if (!AtLeadInWhitespace(context))
              {
            return nextUpdate();
              }

              return context.CheckAllNotNull(JetBrains.IDE.DataConstants.SOLUTION);
        }
 public override bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return context.CheckAllNotNull(IDE.DataConstants.DOCUMENT_SELECTION) &&
     base.Update(context, presentation, nextUpdate);
 }
Ejemplo n.º 59
0
 public abstract bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate);
Ejemplo n.º 60
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return(context.GetData <ISolution>(JetBrains.ProjectModel.DataContext.DataConstants.SOLUTION) != null);
 }