Package org.eclipse.wst.sse.ui.internal.comment

Examples of org.eclipse.wst.sse.ui.internal.comment.CommentingStrategy


          String content = this.fDocument.get(lineRegion.getOffset(), lineRegion.getLength());
          if (content.trim().length() > 0) {
            //try to get a line comment type
            ITypedRegion[] lineTypedRegions =
              this.fDocument.computePartitioning(lineRegion.getOffset(), lineRegion.getLength());
            CommentingStrategy commentType = CommentingStrategyRegistry.getDefault().getLineCommentingStrategy(
                this.fContentType, lineTypedRegions);
           
            //could not find line comment type so find block comment type to use on line
            if(commentType == null) {
              commentType = CommentingStrategyRegistry.getDefault().getBlockCommentingStrategy(
                  this.fContentType, lineTypedRegions);
            }
           
            //toggle the comment on the line
            if(commentType != null) {
              if(commentType.alreadyCommenting(this.fDocument, lineTypedRegions)) {
                commentType.remove(this.fDocument, lineRegion.getOffset(), lineRegion.getLength(), true);
              } else {
                commentType.apply(this.fDocument, lineRegion.getOffset(), lineRegion.getLength());
              }
            }
          }
          monitor.worked(1);
        }
View Full Code Here


        }
        changed = true;
       
        ITypedRegion[] typedRegions = document.computePartitioning(
            textSelection.getOffset(), textSelection.getLength());
        CommentingStrategy commentType = CommentingStrategyRegistry.getDefault().getBlockCommentingStrategy(
            model.getContentTypeIdentifier(), typedRegions);
       
        if(commentType != null) {
          commentType.remove(document, textSelection.getOffset(), textSelection.getLength(), true);
        }
      }
    } catch (BadLocationException e) {
      Logger.logException("The given selection " + textSelection + " must be invalid", e); //$NON-NLS-1$ //$NON-NLS-2$
    } finally {
View Full Code Here

          session = ((IDocumentExtension4)document).startRewriteSession(DocumentRewriteSessionType.UNRESTRICTED);
        }
        changed = true;
       
        ITypedRegion[] typedRegions = document.computePartitioning(textSelection.getOffset(), textSelection.getLength());
        CommentingStrategy commentType = CommentingStrategyRegistry.getDefault().getBlockCommentingStrategy(model.getContentTypeIdentifier(), typedRegions);
       
        if(commentType != null) {
          commentType.apply(document, textSelection.getOffset(), textSelection.getLength());
        }
      }
    } catch (BadLocationException e) {
      Logger.logException("The given selection " + textSelection + " must be invalid", e); //$NON-NLS-1$ //$NON-NLS-2$
    } finally {
View Full Code Here

TOP

Related Classes of org.eclipse.wst.sse.ui.internal.comment.CommentingStrategy

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