本文整理汇总了Java中org.eclipse.jdt.ui.text.IJavaPartitions.JAVA_PARTITIONING属性的典型用法代码示例。如果您正苦于以下问题:Java IJavaPartitions.JAVA_PARTITIONING属性的具体用法?Java IJavaPartitions.JAVA_PARTITIONING怎么用?Java IJavaPartitions.JAVA_PARTITIONING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.ui.text.IJavaPartitions
的用法示例。
在下文中一共展示了IJavaPartitions.JAVA_PARTITIONING属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleSmartTrigger
private void handleSmartTrigger(IDocument document, char trigger, int referenceOffset)
throws BadLocationException {
DocumentCommand cmd = new DocumentCommand() {};
cmd.offset = referenceOffset;
cmd.length = 0;
cmd.text = Character.toString(trigger);
cmd.doit = true;
cmd.shiftsCaret = true;
cmd.caretOffset = getReplacementOffset() + getCursorPosition();
SmartSemicolonAutoEditStrategy strategy =
new SmartSemicolonAutoEditStrategy(IJavaPartitions.JAVA_PARTITIONING);
strategy.customizeDocumentCommand(document, cmd);
replace(document, cmd.offset, cmd.length, cmd.text);
setCursorPosition(cmd.caretOffset - getReplacementOffset() + cmd.text.length());
}
示例2: handleSmartTrigger
private void handleSmartTrigger(IDocument document, char trigger, int referenceOffset) throws BadLocationException {
DocumentCommand cmd= new DocumentCommand() {
};
cmd.offset= referenceOffset;
cmd.length= 0;
cmd.text= Character.toString(trigger);
cmd.doit= true;
cmd.shiftsCaret= true;
cmd.caretOffset= getReplacementOffset() + getCursorPosition();
SmartSemicolonAutoEditStrategy strategy= new SmartSemicolonAutoEditStrategy(IJavaPartitions.JAVA_PARTITIONING);
strategy.customizeDocumentCommand(document, cmd);
replace(document, cmd.offset, cmd.length, cmd.text);
setCursorPosition(cmd.caretOffset - getReplacementOffset() + cmd.text.length());
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:17,代码来源:AbstractJavaCompletionProposal.java
示例3: createViewer
@Override
protected SourceViewer createViewer(Composite parent) {
IDocument document= new Document();
JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
tools.setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING);
IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
SourceViewer viewer= new JavaSourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, store);
SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, false);
viewer.configure(configuration);
viewer.setEditable(false);
viewer.setDocument(document);
Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
viewer.getTextWidget().setFont(font);
new JavaSourcePreviewerUpdater(viewer, configuration, store);
Control control= viewer.getControl();
GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
control.setLayoutData(data);
return viewer;
}
示例4: createPatternViewer
@Override
protected SourceViewer createPatternViewer(Composite parent) {
IDocument document= new Document();
JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
tools.setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING);
IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
JavaSourceViewer viewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL, store);
SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, false);
viewer.configure(configuration);
viewer.setEditable(false);
viewer.setDocument(document);
Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
viewer.getTextWidget().setFont(font);
new JavaSourcePreviewerUpdater(viewer, configuration, store);
Control control= viewer.getControl();
GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
control.setLayoutData(data);
viewer.setEditable(false);
return viewer;
}
示例5: doSetInput
@Override
protected void doSetInput(IEditorInput input) throws CoreException {
IJavaProject javaProject = EditorUtility.getJavaProject(input);
if (javaProject != null && GWTNature.isGWTProject(javaProject.getProject())) {
// Use GWT partitioning if the compilation unit is in a GWT project
inputPartitioning = GWTPartitions.GWT_PARTITIONING;
} else {
// Otherwise, use Java partitioning to emulate the Java editor
inputPartitioning = IJavaPartitions.JAVA_PARTITIONING;
}
super.doSetInput(input);
}
示例6: getConfiguredDocumentPartitioning
@Override
public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
try {
ITextEditor editor = getEditor();
return ((GWTJavaEditor) editor).getInputPartitioning();
} catch (Exception e) {
GWTPluginLog.logError(e);
return IJavaPartitions.JAVA_PARTITIONING;
}
}
示例7: 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();
}
示例8: internalCreatePartControl
@Override
protected void internalCreatePartControl(Composite parent) {
IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
fViewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL, store);
fViewerConfiguration= new SimpleJavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, false);
fViewer.configure(fViewerConfiguration);
fViewer.setEditable(false);
setViewerFont();
JFaceResources.getFontRegistry().addListener(fFontPropertyChangeListener);
store.addPropertyChangeListener(fPropertyChangeListener);
getViewSite().setSelectionProvider(fViewer);
}
示例9: isLessThanOperator
/**
* Returns <code>true</code> if the character at the specified offset is a less-than sign, rather than
* the opening angle bracket of a type parameter list.
*
* @param document a document
* @param offset an offset within the document
* @return <code>true</code> if the character at the specified offset is a less-than sign
* @throws BadLocationException if offset is invalid in the document
*/
private boolean isLessThanOperator(IDocument document, int offset) throws BadLocationException {
if (offset < 0) return false;
String contentType= TextUtilities.getContentType(document, IJavaPartitions.JAVA_PARTITIONING, offset, false);
if (!IDocument.DEFAULT_CONTENT_TYPE.equals(contentType)) {
return false;
}
JavaHeuristicScanner scanner= new JavaHeuristicScanner(document, IJavaPartitions.JAVA_PARTITIONING, contentType);
return !isTypeParameterOpeningBracket(offset, document, scanner);
}
示例10: isGreaterThanOperator
/**
* Returns true if the character at the specified offset is a greater-than sign, rather than an
* type parameter list close angle bracket.
*
* @param document a document
* @param offset an offset within the document
* @return true if the character at the specified offset is a greater-than sign
* @throws BadLocationException if offset is invalid in the document
*/
private boolean isGreaterThanOperator(IDocument document, int offset) throws BadLocationException {
if (offset < 0)
return false;
String contentType= TextUtilities.getContentType(document, IJavaPartitions.JAVA_PARTITIONING, offset, false);
if (!IDocument.DEFAULT_CONTENT_TYPE.equals(contentType)) {
return false;
}
JavaHeuristicScanner scanner= new JavaHeuristicScanner(document, IJavaPartitions.JAVA_PARTITIONING, contentType);
return !isTypeParameterClosingBracket(offset, document, scanner);
}
示例11: createPreviewer
private Control createPreviewer(Composite parent) {
IPreferenceStore generalTextStore= EditorsUI.getPreferenceStore();
IPreferenceStore store= new ChainedPreferenceStore(new IPreferenceStore[] { getPreferenceStore(), new PreferencesAdapter(createTemporaryCorePreferenceStore()), generalTextStore });
fPreviewViewer= new JavaSourceViewer(parent, null, null, false, SWT.H_SCROLL | SWT.BORDER, store);
SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(fColorManager, store, null, IJavaPartitions.JAVA_PARTITIONING, false);
fPreviewViewer.configure(configuration);
// fake 1.5 source to get 1.5 features right.
configuration.handlePropertyChangeEvent(new PropertyChangeEvent(this, JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_4, JavaCore.VERSION_1_5));
Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
fPreviewViewer.getTextWidget().setFont(font);
new JavaSourcePreviewerUpdater(fPreviewViewer, configuration, store);
fPreviewViewer.setEditable(false);
Cursor arrowCursor= fPreviewViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
fPreviewViewer.getTextWidget().setCursor(arrowCursor);
// Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263
// fPreviewViewer.getTextWidget().setCaret(null);
String content= loadPreviewContentFromFile("ColorSettingPreviewCode.txt"); //$NON-NLS-1$
IDocument document= new Document(content);
JavaPlugin.getDefault().getJavaTextTools().setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING);
fPreviewViewer.setDocument(document);
installSemanticHighlighting();
return fPreviewViewer.getControl();
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:30,代码来源:JavaEditorColoringConfigurationBlock.java
示例12: JavaPreview
public JavaPreview(Map<String, String> workingValues, Composite parent) {
JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
fPreviewDocument= new Document();
fWorkingValues= workingValues;
tools.setupJavaDocumentPartitioner( fPreviewDocument, IJavaPartitions.JAVA_PARTITIONING);
PreferenceStore prioritizedSettings= new PreferenceStore();
HashMap<String, String> complianceOptions= new HashMap<String, String>();
JavaModelUtil.setComplianceOptions(complianceOptions, JavaModelUtil.VERSION_LATEST);
for (Entry<String, String> complianceOption : complianceOptions.entrySet()) {
prioritizedSettings.setValue(complianceOption.getKey(), complianceOption.getValue());
}
IPreferenceStore[] chain= { prioritizedSettings, JavaPlugin.getDefault().getCombinedPreferenceStore() };
fPreferenceStore= new ChainedPreferenceStore(chain);
fSourceViewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, fPreferenceStore);
fSourceViewer.setEditable(false);
Cursor arrowCursor= fSourceViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
fSourceViewer.getTextWidget().setCursor(arrowCursor);
// Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263
// fSourceViewer.getTextWidget().setCaret(null);
fViewerConfiguration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), fPreferenceStore, null, IJavaPartitions.JAVA_PARTITIONING, true);
fSourceViewer.configure(fViewerConfiguration);
fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
fMarginPainter= new MarginPainter(fSourceViewer);
final RGB rgb= PreferenceConverter.getColor(fPreferenceStore, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR);
fMarginPainter.setMarginRulerColor(tools.getColorManager().getColor(rgb));
fSourceViewer.addPainter(fMarginPainter);
new JavaSourcePreviewerUpdater();
fSourceViewer.setDocument(fPreviewDocument);
}
示例13: HydrographJavaSourceViewerConfiguration
public HydrographJavaSourceViewerConfiguration(IColorManager colorManager, IPreferenceStore preferenceStore,
SourceViewer viewer) {
super(colorManager, preferenceStore,null, IJavaPartitions.JAVA_PARTITIONING);
this.viewer = viewer;
}
示例14: run
public void run(IAction action) {
if (targetEditor == null) {
GWTPluginLog.logWarning("targetEditor is null");
return;
}
IEditorInput editorInput = targetEditor.getEditorInput();
IResource resource = (IResource) editorInput.getAdapter(IResource.class);
ITextEditor javaEditor = (ITextEditor) targetEditor;
ITextSelection sel = (ITextSelection) javaEditor.getSelectionProvider().getSelection();
IDocument document = javaEditor.getDocumentProvider().getDocument(
javaEditor.getEditorInput());
IDocumentExtension3 document3 = (IDocumentExtension3) document;
IDocumentPartitioner gwtPartitioner = document3.getDocumentPartitioner(GWTPartitions.GWT_PARTITIONING);
String[] partitionings = document3.getPartitionings();
String partitioning = (gwtPartitioner != null
? GWTPartitions.GWT_PARTITIONING : IJavaPartitions.JAVA_PARTITIONING);
ITypedRegion[] types;
try {
types = TextUtilities.computePartitioning(document, partitioning,
sel.getOffset(), sel.getLength(), false);
} catch (BadLocationException e) {
GWTPluginLog.logError(e);
return;
}
String msg = "File: " + resource.getName();
msg += "\nPartitionings: ";
for (String part : partitionings) {
msg += "\n" + part;
}
msg += "\n\nContent types: ";
for (ITypedRegion type : types) {
msg += "\n" + type.getType();
}
msg += "\n\nSelection range: (offset = " + sel.getOffset() + ", length = "
+ sel.getLength() + ")";
MessageDialog.openInformation(targetEditor.getSite().getShell(),
"Selection Info", msg);
}
示例15: createChangeHover
@Override
protected LineChangeHover createChangeHover() {
return new JavaChangeHover(IJavaPartitions.JAVA_PARTITIONING, getOrientation());
}