Java 类org.eclipse.ui.internal.editors.text.EditorsPlugin 实例源码

项目:Hydrograph    文件:SourceViewer.java   
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);
}
项目:velocity-edit    文件:VelocityConfiguration.java   
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";
}
项目:eclipse-silverstripedt    文件:SilverStripeTemplateStore.java   
/**
 * 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;
}
项目:velocity-edit    文件:VelocityConfiguration.java   
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;
}
项目:velocity-edit    文件:VelocityConfiguration.java   
public int getLineWidth(ISourceViewer isourceviewer)
{
    IPreferenceStore prefs =
    EditorsPlugin.getDefault().getPreferenceStore();
    int width =  prefs.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN);
    return width;
}
项目:gama    文件:AutoStartup.java   
@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) {}
}
项目:gama    文件:AutoStartup.java   
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);
}
项目:APICloud-Studio    文件:EditorUtil.java   
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;
}
项目:anatlyzer    文件:AnalysisQuickAssistAssistant.java   
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() { .. });
}
项目:anatlyzer    文件:AnalysisQuickAssistAssistant.java   
private IInformationControlCreator getQuickAssistAssistantInformationControlCreator() {
    return new IInformationControlCreator() {
        public IInformationControl createInformationControl(Shell parent) {
            return new DefaultInformationControl(parent, EditorsPlugin.getAdditionalInfoAffordanceString());
        }
    };
}
项目:bts    文件:WrappedSourceViewer.java   
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();
}
项目:statecharts    文件:StyledTextXtextAdapter.java   
protected ISharedTextColors getSharedColors() {
    return EditorsPlugin.getDefault().getSharedTextColors();
}
项目:gwt-eclipse-plugin    文件:GWTJavaSpellingReconcileStrategy.java   
private GWTSpellingService() {
  super(EditorsPlugin.getDefault().getPreferenceStore());
}
项目:PDFReporter-Studio    文件:StyledTextXtextAdapter.java   
protected ISharedTextColors getSharedColors() {
    return EditorsPlugin.getDefault().getSharedTextColors();
}
项目:gama    文件:AutoStartup.java   
@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);
}
项目:gama    文件:AutoStartup.java   
public static GamaFont getDefaultFontData() {
    final FontData fd = PreferenceConverter.getFontData(EditorsPlugin.getDefault().getPreferenceStore(),
            JFaceResources.TEXT_FONT);
    return new GamaFont(fd.getName(), fd.getStyle(), fd.getHeight());
}
项目:gama    文件:GamlHighlightingConfiguration.java   
public static GamaFont getDefaultFont() {
    final FontData fd = PreferenceConverter.getFontData(EditorsPlugin.getDefault().getPreferenceStore(),
            JFaceResources.TEXT_FONT);
    return new GamaFont(fd.getName(), fd.getStyle(), fd.getHeight());
}
项目:APICloud-Studio    文件:XMLEditor.java   
public static IPreferenceStore getChainedPreferenceStore()
{
    return new ChainedPreferenceStore(new IPreferenceStore[] { XMLPlugin.getDefault().getPreferenceStore(),
            CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}
项目:APICloud-Studio    文件:JSSourceEditor.java   
public static IPreferenceStore getChainedPreferenceStore()
{
    return new ChainedPreferenceStore(new IPreferenceStore[] { JSPlugin.getDefault().getPreferenceStore(),
            CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}
项目:APICloud-Studio    文件:DTDEditor.java   
public static IPreferenceStore getChainedPreferenceStore()
{
    return new ChainedPreferenceStore(new IPreferenceStore[] { DTDPlugin.getDefault().getPreferenceStore(),
            CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}
项目:APICloud-Studio    文件:CSSSourceEditor.java   
public static IPreferenceStore getChainedPreferenceStore()
{
    return new ChainedPreferenceStore(new IPreferenceStore[] { CSSPlugin.getDefault().getPreferenceStore(),
            CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}
项目:APICloud-Studio    文件:HTMLEditor.java   
public static IPreferenceStore getChainedPreferenceStore()
{
    return new ChainedPreferenceStore(new IPreferenceStore[] { HTMLPlugin.getDefault().getPreferenceStore(),
            CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}
项目:APICloud-Studio    文件:AbstractThemeableEditor.java   
@Override
protected void initializeEditor()
{
    setPreferenceStore(new ChainedPreferenceStore(new IPreferenceStore[] {
            CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() }));
}
项目:SPLevo    文件:UnifiedDiffHighlighter.java   
/**
 * 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;
}
项目:dLabPro-Plugin    文件:CommonSourceViewerConfiguration.java   
public int getTabWidth(ISourceViewer sourceViewer) {
 return EditorsPlugin.getDefault().getPreferenceStore().getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);
}
项目:APICloud-Studio    文件:FormatterUtils.java   
/**
 * 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);
}
项目:APICloud-Studio    文件:FormatterUtils.java   
/**
 * 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);
}