private void initializeViewer(IDocument document) { fAnnotationPreferences = EditorsPlugin.getDefault().getMarkerAnnotationPreferences(); setDocument(document); installViewerConfiguration(); setEditable(true); Font font = JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT); getTextWidget().setFont(font); getTextWidget().setData("document",document); Control control = getControl(); GridData data = new GridData(GridData.FILL_BOTH); control.setLayoutData(data); prependVerifyKeyListener(new VerifyKeyListener() { @Override public void verifyKey(VerifyEvent event) { handleVerifyKeyPressed(event); } }); addDocumentListener(document); }
public String getTab(ISourceViewer isourceviewer) { IPreferenceStore prefs = EditorsPlugin.getDefault().getPreferenceStore(); if (prefs.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS)) { int tabWidth = getTabWidth(isourceviewer); StringBuffer sb = new StringBuffer(tabWidth); for (int i=0; i<tabWidth; i++) { sb.append(' '); } return sb.toString(); } return "\t"; }
/** * Validates a template against the context type registered in the context * type registry. Returns always <code>true</code> if no registry is * present. * * @param template the template to validate * @return <code>true</code> if validation is successful or no context * type registry is specified, <code>false</code> if validation * fails */ private boolean validateTemplate(Template template) { String contextTypeId= template.getContextTypeId(); if (!contextExists(contextTypeId)) return false; if (getRegistry() != null) { try { getRegistry().getContextType(contextTypeId).validate(template.getPattern()); } catch (TemplateException e) { EditorsPlugin.log(NLSUtility.format("Ignoring template \"{0}\" since validation failed.", template.getName()), e); return false; } } return true; }
public int getTabWidth(ISourceViewer aSourceViewer) { // Get tab width from JDT preferences settings IPreferenceStore prefs = EditorsPlugin.getDefault().getPreferenceStore(); int width = prefs.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH); return width; }
public int getLineWidth(ISourceViewer isourceviewer) { IPreferenceStore prefs = EditorsPlugin.getDefault().getPreferenceStore(); int width = prefs.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN); return width; }
@Override public void afterValueChange(final GamaFont font) { try { final FontData newValue = new FontData(font.getName(), font.getSize(), font.getStyle()); PreferenceConverter.setValue(EditorsPlugin.getDefault().getPreferenceStore(), JFaceResources.TEXT_FONT, newValue); } catch (final Exception e) {} }
private static GamaColor getDefaultBackground() { EditorsPlugin.getDefault().getPreferenceStore() .setValue(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, false); final RGB rgb = PreferenceConverter.getColor(EditorsPlugin.getDefault().getPreferenceStore(), AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND); return new GamaColor(rgb.red, rgb.green, rgb.blue); }
public static int getDefaultSpaceIndentSize(String preferencesQualifier) { int spaceIndentSize = 0; if (CommonEditorPlugin.getDefault() != null && EditorsPlugin.getDefault() != null) { spaceIndentSize = new ChainedPreferenceStore(new IPreferenceStore[] { CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() }) .getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH); } return (spaceIndentSize > 0) ? spaceIndentSize : DEFAULT_SPACE_INDENT_SIZE; }
public AnalysisQuickAssistAssistant(AtlEditor atlEditor) { this.fEditor = atlEditor; // IContentAssistProcessor // ICompletionProposal this.setQuickAssistProcessor(new AnalysisQuickfixProcessor(fEditor)); this.setRestoreCompletionProposalSize(EditorsPlugin.getDefault().getDialogSettingsSection("quick_assist_proposal_size")); //$NON-NLS-1$ this.setInformationControlCreator(getQuickAssistAssistantInformationControlCreator()); this.enableColoredLabels(true); // Events about completion... not needed for the moment // addCompletionListener(new ICompletionListener() { .. }); }
private IInformationControlCreator getQuickAssistAssistantInformationControlCreator() { return new IInformationControlCreator() { public IInformationControl createInformationControl(Shell parent) { return new DefaultInformationControl(parent, EditorsPlugin.getAdditionalInfoAffordanceString()); } }; }
public void createPartControl(Composite parent) { int VERTICAL_RULER_WIDTH = 12; int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION; ISharedTextColors sharedColors = EditorsPlugin.getDefault().getSharedTextColors(); IOverviewRuler overviewRuler = new OverviewRuler(null, VERTICAL_RULER_WIDTH, sharedColors); CompositeRuler ruler = new CompositeRuler(VERTICAL_RULER_WIDTH); _document = new Document(); _document.set(_docString); _annotationModel = new AnnotationModel(); _annotationModel.connect(_document); _sourceViewer = new SourceViewer(parent, ruler, overviewRuler, true, styles); _sourceViewer.configure(new SourceViewerConfiguration()); _sds = new SourceViewerDecorationSupport(_sourceViewer, overviewRuler, null, sharedColors); AnnotationPreference ap = new AnnotationPreference(); ap.setColorPreferenceKey(ANNO_KEY_COLOR); ap.setHighlightPreferenceKey(ANNO_KEY_HIGHLIGHT); ap.setVerticalRulerPreferenceKey(ANNO_KEY_VERTICAL); ap.setOverviewRulerPreferenceKey(ANNO_KEY_OVERVIEW); ap.setTextPreferenceKey(ANNO_KEY_TEXT); ap.setAnnotationType(ANNO_TYPE); _sds.setAnnotationPreference(ap); // _sds.install(EditorsPlugin.getDefault().getPreferenceStore()); _sourceViewer.setDocument(_document, _annotationModel); _sourceViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); ruler.addDecorator(0, new LineNumberRulerColumn()); Annotation annotation = new Annotation(false); annotation.setType(ANNO_TYPE); Position position = new Position(0, 4); _annotationModel.addAnnotation(annotation, position); parent.layout(); }
protected ISharedTextColors getSharedColors() { return EditorsPlugin.getDefault().getSharedTextColors(); }
private GWTSpellingService() { super(EditorsPlugin.getDefault().getPreferenceStore()); }
@Override public void afterValueChange(final GamaColor c) { final RGB rgb = new RGB(c.getRed(), c.getGreen(), c.getBlue()); PreferenceConverter.setValue(EditorsPlugin.getDefault().getPreferenceStore(), AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, rgb); }
public static GamaFont getDefaultFontData() { final FontData fd = PreferenceConverter.getFontData(EditorsPlugin.getDefault().getPreferenceStore(), JFaceResources.TEXT_FONT); return new GamaFont(fd.getName(), fd.getStyle(), fd.getHeight()); }
public static GamaFont getDefaultFont() { final FontData fd = PreferenceConverter.getFontData(EditorsPlugin.getDefault().getPreferenceStore(), JFaceResources.TEXT_FONT); return new GamaFont(fd.getName(), fd.getStyle(), fd.getHeight()); }
public static IPreferenceStore getChainedPreferenceStore() { return new ChainedPreferenceStore(new IPreferenceStore[] { XMLPlugin.getDefault().getPreferenceStore(), CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() }); }
public static IPreferenceStore getChainedPreferenceStore() { return new ChainedPreferenceStore(new IPreferenceStore[] { JSPlugin.getDefault().getPreferenceStore(), CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() }); }
public static IPreferenceStore getChainedPreferenceStore() { return new ChainedPreferenceStore(new IPreferenceStore[] { DTDPlugin.getDefault().getPreferenceStore(), CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() }); }
public static IPreferenceStore getChainedPreferenceStore() { return new ChainedPreferenceStore(new IPreferenceStore[] { CSSPlugin.getDefault().getPreferenceStore(), CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() }); }
public static IPreferenceStore getChainedPreferenceStore() { return new ChainedPreferenceStore(new IPreferenceStore[] { HTMLPlugin.getDefault().getPreferenceStore(), CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() }); }
@Override protected void initializeEditor() { setPreferenceStore(new ChainedPreferenceStore(new IPreferenceStore[] { CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() })); }
/** * Highlights the differences within the unified difference editor. * * @return the color to unified lines mapping. */ @SuppressWarnings({ "unchecked" }) public Map<Integer, Color> highlightLines() { // initialize local variables UnifiedDiffConnectorModel diffModel = editorInput.getDiffConnectorModel(); Map<Integer, Color> colorToUnifiedLinesMapping = new HashMap<Integer, Color>(); MarkerAnnotationPreferences maPrefs = EditorsPlugin.getDefault().getMarkerAnnotationPreferences(); List<AnnotationPreference> aPrefs = (List<AnnotationPreference>) (List<?>) maPrefs.getAnnotationPreferences(); IFile ressource = (IFile) editorInput.getAdapter(IFile.class); // add new markers from connector content int offset = 0; int lineCount = editor.getViewer().getTextWidget().getLineCount(); int lineTextLength = 0; String lineText = ""; for (int line = 0; line < lineCount - 1; line++) { lineText = editor.getViewer().getTextWidget().getLine(line); lineTextLength = lineText.length(); // create marker according to type MarkerType markerType = diffModel.getMarkerTypeFor(line); if (markerType != MarkerType.NONE) { try { IMarker marker = ressource.createMarker(UIConstants.UNIFIED_DIFF_MARKERTYPE); TextSelection selection = new TextSelection(offset, lineTextLength); createAnnotation(marker, selection, this.editor, markerType); } catch (CoreException exception) { LOGGER.error("An error occurred while creating a marker or setting an attribute for said marker!", exception); } // get and add color to mapping IGetMarkerColor getMarkerColor = markerTypeToGetMarkerColor.get(markerType); colorToUnifiedLinesMapping.put(line, getMarkerColor.get(aPrefs)); } offset += lineTextLength + 1; } return colorToUnifiedLinesMapping; }
public int getTabWidth(ISourceViewer sourceViewer) { return EditorsPlugin.getDefault().getPreferenceStore().getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH); }
/** * Returns the editor's tab width as set in the given editor's-specific preferences. In case a value is not found, * or the preferences are null, the workspace settings for the editor's tab-width will be returned. * * @param preferenceStore * The editor's preferences store; Null, in case a workspace setting is needed. * @return The editor's tab-width * @deprecated Use EditorUtil.getSpaceIndentSize(preferencesQualifier) */ public static int getEditorTabWidth(IPreferenceStore preferenceStore) { IPreferenceStore prefs = getChainedPreferences(preferenceStore, EditorsPlugin.getDefault().getPreferenceStore()); return prefs.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH); }
/** * Returns the editor's setting for 'Insert Spaces for Tabs'. This setting exists in the general 'Text Editors' * preference page. * * @param preferenceStore * The editor's preferences store; Null, in case a workspace setting is needed. * @return The value for the generic editor's 'Insert Spaces for Tabs' */ public static boolean isInsertSpacesForTabs(IPreferenceStore preferenceStore) { IPreferenceStore prefs = getChainedPreferences(preferenceStore, EditorsPlugin.getDefault().getPreferenceStore()); return prefs.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS); }