本文整理汇总了Java中org.eclipse.jdt.ui.text.IJavaPartitions.JAVA_MULTI_LINE_COMMENT属性的典型用法代码示例。如果您正苦于以下问题:Java IJavaPartitions.JAVA_MULTI_LINE_COMMENT属性的具体用法?Java IJavaPartitions.JAVA_MULTI_LINE_COMMENT怎么用?Java IJavaPartitions.JAVA_MULTI_LINE_COMMENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.ui.text.IJavaPartitions
的用法示例。
在下文中一共展示了IJavaPartitions.JAVA_MULTI_LINE_COMMENT属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: installJavaStuff
/**
* Installs a java partitioner with <code>document</code>.
*
* @param document the document
*/
private static void installJavaStuff(Document document) {
String[] types =
new String[] {
IJavaPartitions.JAVA_DOC,
IJavaPartitions.JAVA_MULTI_LINE_COMMENT,
IJavaPartitions.JAVA_SINGLE_LINE_COMMENT,
IJavaPartitions.JAVA_STRING,
IJavaPartitions.JAVA_CHARACTER,
IDocument.DEFAULT_CONTENT_TYPE
};
FastPartitioner partitioner = new FastPartitioner(new FastJavaPartitionScanner(), types);
partitioner.connect(document);
document.setDocumentPartitioner(IJavaPartitions.JAVA_PARTITIONING, partitioner);
}
示例2: createControl
@Override
public void createControl(Composite parent) {
composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(1, false));
generateJUnitTimeoutEditor = new Button(composite, SWT.CHECK | SWT.LEFT);
generateJUnitTimeoutEditor.setText("Use timeouts in generated test cases");
generateJUnitTimeoutEditor.setSelection(EclipseForcesPlugin.getDefault()
.isGenerateJUnitTimeout());
codeTemplateLabel = new Label(composite, SWT.NONE);
codeTemplateLabel.setText("Code template:");
codeTemplateEditor = new SourceViewer(composite, null, SWT.MULTI | SWT.H_SCROLL
| SWT.V_SCROLL | SWT.BORDER);
JavaSourceViewerConfiguration config = new JavaSourceViewerConfiguration(JavaUI.getColorManager(), JavaPlugin.getDefault().getCombinedPreferenceStore(), null, IJavaPartitions.JAVA_PARTITIONING);
codeTemplateEditor.configure(config);
Document doc = new Document(EclipseForcesPlugin.getDefault().getCodeTemplate());
JavaPartitionScanner scanner = new JavaPartitionScanner();
FastPartitioner fp = new FastPartitioner(scanner, new String[] {IJavaPartitions.JAVA_STRING, IJavaPartitions.JAVA_MULTI_LINE_COMMENT, IJavaPartitions.JAVA_CHARACTER,
IJavaPartitions.JAVA_DOC, IJavaPartitions.JAVA_SINGLE_LINE_COMMENT});
fp.connect(doc);
doc.setDocumentPartitioner(IJavaPartitions.JAVA_PARTITIONING, fp);
codeTemplateEditor.setDocument(doc);
codeTemplateEditor.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
codeTemplateEditor.getControl().pack();
}
示例3: installJavaStuff
/**
* Installs a java partitioner with <code>document</code>.
*
* @param document the document
*/
private static void installJavaStuff(Document document) {
String[] types= new String[] {
IJavaPartitions.JAVA_DOC,
IJavaPartitions.JAVA_MULTI_LINE_COMMENT,
IJavaPartitions.JAVA_SINGLE_LINE_COMMENT,
IJavaPartitions.JAVA_STRING,
IJavaPartitions.JAVA_CHARACTER,
IDocument.DEFAULT_CONTENT_TYPE
};
FastPartitioner partitioner= new FastPartitioner(new FastJavaPartitionScanner(), types);
partitioner.connect(document);
document.setDocumentPartitioner(IJavaPartitions.JAVA_PARTITIONING, partitioner);
}
示例4: runInternal
@Override
protected void runInternal(ITextSelection selection, IDocumentExtension3 docExtension, Edit.EditFactory factory) throws BadPartitioningException, BadLocationException {
List<Edit> edits= new LinkedList<Edit>();
int tokenLength= getCommentStart().length();
int offset= selection.getOffset();
int endOffset= offset + selection.getLength();
ITypedRegion partition= docExtension.getPartition(IJavaPartitions.JAVA_PARTITIONING, offset, false);
int partOffset= partition.getOffset();
int partEndOffset= partOffset + partition.getLength();
while (partEndOffset < endOffset) {
if (partition.getType() == IJavaPartitions.JAVA_MULTI_LINE_COMMENT) {
edits.add(factory.createEdit(partOffset, tokenLength, "")); //$NON-NLS-1$
edits.add(factory.createEdit(partEndOffset - tokenLength, tokenLength, "")); //$NON-NLS-1$
}
partition= docExtension.getPartition(IJavaPartitions.JAVA_PARTITIONING, partEndOffset, false);
partOffset= partition.getOffset();
partEndOffset= partOffset + partition.getLength();
}
if (partition.getType() == IJavaPartitions.JAVA_MULTI_LINE_COMMENT) {
edits.add(factory.createEdit(partOffset, tokenLength, "")); //$NON-NLS-1$
edits.add(factory.createEdit(partEndOffset - tokenLength, tokenLength, "")); //$NON-NLS-1$
}
executeEdits(edits);
}
示例5: handleInteriorPartition
/**
* Handles partition boundaries within the selection. The end of the current
* partition and the start of the next partition are examined for whether
* they contain comment tokens that interfere with the created comment.
* <p>
* Comment tokens are removed from interior multi-line comments. Javadoc
* comments are left as is; instead, multi-line comment tokens are inserted
* before and after Javadoc partitions to ensure that the entire selected
* area is commented.
* </p>
* <p>
* The next partition is returned.
* </p>
*
* @param partition the current partition
* @param edits the list of edits to add to
* @param factory the edit factory
* @param docExtension the document to get the partitions from
* @return the next partition after the current
* @throws BadLocationException if accessing the document fails - this can
* only happen if the document gets modified concurrently
* @throws BadPartitioningException if the document does not have a Java
* partitioning
*/
private ITypedRegion handleInteriorPartition(ITypedRegion partition, List<Edit> edits, Edit.EditFactory factory, IDocumentExtension3 docExtension) throws BadPartitioningException, BadLocationException {
// end of previous partition
String partType= partition.getType();
int partEndOffset= partition.getOffset() + partition.getLength();
int tokenLength= getCommentStart().length();
boolean wasJavadoc= false; // true if the previous partition is javadoc
if (partType == IJavaPartitions.JAVA_DOC) {
wasJavadoc= true;
} else if (partType == IJavaPartitions.JAVA_MULTI_LINE_COMMENT) {
// already in a comment - remove ending mark
edits.add(factory.createEdit(partEndOffset - tokenLength, tokenLength, "")); //$NON-NLS-1$
}
// advance to next partition
partition= docExtension.getPartition(IJavaPartitions.JAVA_PARTITIONING, partEndOffset, false);
partType= partition.getType();
// start of next partition
if (wasJavadoc) {
// if previous was javadoc, and the current one is not a comment,
// then add a block comment start
if (partType == IDocument.DEFAULT_CONTENT_TYPE
|| isSpecialPartition(partType)) {
edits.add(factory.createEdit(partition.getOffset(), 0, getCommentStart()));
}
} else { // !wasJavadoc
if (partType == IJavaPartitions.JAVA_DOC) {
// if next is javadoc, end block comment before
edits.add(factory.createEdit(partition.getOffset(), 0, getCommentEnd()));
} else if (partType == IJavaPartitions.JAVA_MULTI_LINE_COMMENT) {
// already in a comment - remove startToken
edits.add(factory.createEdit(partition.getOffset(), getCommentStart().length(), "")); //$NON-NLS-1$
}
}
return partition;
}
示例6: getContentAssistant
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
ContentAssistant assistant = new ContentAssistant();
assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
assistant.setRestoreCompletionProposalSize(getSettings("completion_proposal_size")); //$NON-NLS-1$
IContentAssistProcessor javaProcessor = new HydrographJavaCompletionProcessor(assistant, IDocument.DEFAULT_CONTENT_TYPE);
assistant.setContentAssistProcessor(javaProcessor, IDocument.DEFAULT_CONTENT_TYPE);
ContentAssistProcessor singleLineProcessor = new HydrographJavaCompletionProcessor(assistant,
IJavaPartitions.JAVA_SINGLE_LINE_COMMENT);
assistant.setContentAssistProcessor(singleLineProcessor, IJavaPartitions.JAVA_SINGLE_LINE_COMMENT);
ContentAssistProcessor stringProcessor = new HydrographJavaCompletionProcessor(assistant, IJavaPartitions.JAVA_STRING);
assistant.setContentAssistProcessor(stringProcessor, IJavaPartitions.JAVA_STRING);
ContentAssistProcessor multiLineProcessor = new HydrographJavaCompletionProcessor(assistant,
IJavaPartitions.JAVA_MULTI_LINE_COMMENT);
assistant.setContentAssistProcessor(multiLineProcessor, IJavaPartitions.JAVA_MULTI_LINE_COMMENT);
ContentAssistProcessor javadocProcessor = new HydrographJavaCompletionProcessor(assistant,
IJavaPartitions.JAVA_DOC);
assistant.setContentAssistProcessor(javadocProcessor, IJavaPartitions.JAVA_DOC);
ContentAssistPreference.configure(assistant, fPreferenceStore);
assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
return assistant;
}