org.eclipse.ui.internal.editors.text.EditorsPlugin Java Examples

The following examples show how to use org.eclipse.ui.internal.editors.text.EditorsPlugin. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FormatterPreview.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
public FormatterPreview(Composite parent, String resFileName, XdsSourceType xdsSourceType) {
    super(parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
    this.xdsSourceType = xdsSourceType;
    this.styledText = this.getTextWidget();
    
    String resPath = RESOURCE_FOLDER_LOCATION + resFileName; 
    try(InputStream resourceStream = ResourceUtils.getPluginResourceAsStream(ResourceUtils.getXdsResourcesPluginBundle(), resPath)) {
    	this.initialText = IOUtils.toString(resourceStream);
    } 
    catch (Exception e) {
        this.initialText = "** Internal error: can't read " + resPath + "\n** Preview not available"; //$NON-NLS-1$ //$NON-NLS-2$
    }

    Font font= JFaceResources.getTextFont();
    styledText.setFont(font);
    defBackgroundColor = getEditorBackgroundColor(EditorsPlugin.getDefault().getPreferenceStore());
    styledText.setBackground(defBackgroundColor);
    
    styledText.setText(initialText);
    colorIt();
}
 
Example #2
Source File: AutoStartup.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void earlyStartup() {
	GamaPreferences.Modeling.EDITOR_BASE_FONT.init(() -> getDefaultFontData()).onChange(font -> {
		try {
			final FontData newValue = new FontData(font.getName(), font.getSize(), font.getStyle());
			setValue(EditorsPlugin.getDefault().getPreferenceStore(), TEXT_FONT, newValue);
		} catch (final Exception e) {}
	});
	GamaPreferences.Modeling.EDITOR_BACKGROUND_COLOR.init(() -> getDefaultBackground()).onChange(c -> {
		final RGB rgb = new RGB(c.getRed(), c.getGreen(), c.getBlue());
		PreferenceConverter.setValue(EditorsPlugin.getDefault().getPreferenceStore(),
				AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, rgb);
		GamaPreferences.Modeling.OPERATORS_MENU_SORT
				.onChange(newValue -> OperatorsReferenceMenu.byName = newValue.equals("Name"));
	});
	GamlRuntimeModule.staticInitialize();
	GamlEditorBindings.install();
	GamlReferenceSearch.install();
}
 
Example #3
Source File: EditorUtil.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #4
Source File: ModulaSearchLabelProvider.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
public void initialize(ColumnViewer viewer, ViewerColumn column) {
    PlatformUI.getPreferenceStore().addPropertyChangeListener(this);
    EditorsPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this); 
    JFaceResources.getColorRegistry().addListener(this);

    setOwnerDrawEnabled(showColoredLabels());

    super.initialize(viewer, column);
}
 
Example #5
Source File: DerivedSourceView.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
private Color getColorFromStore(IPreferenceStore store, String isDefaultKey, int systemDefault, String key) {
	String isDefault = store.getString(isDefaultKey);
	if(Strings.isEmpty(isDefault) || Strings.equal("true", isDefault)) {
		return getDisplay().getSystemColor(systemDefault);
	} else {
		RGB rgb = PreferenceConverter.getColor(store, key);
		return EditorsPlugin.getDefault().getSharedTextColors().getColor(rgb);
	}
}
 
Example #6
Source File: SwaggerEditor.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 5 votes vote down vote up
public SwaggerEditor() {
    super(new SwaggerDocumentProvider(), //
            // ZEN-4361 Missing marker location indicators (Overview Ruler) next to editor
            // scrollbar in KZOE
            new ChainedPreferenceStore(new IPreferenceStore[] { //
                    Activator.getDefault().getPreferenceStore(), //
                    // Preferences store for EditorsPlugin has settings to show/hide the rules and
                    // markers
                    EditorsPlugin.getDefault().getPreferenceStore() }));

    getPreferenceStore().addPropertyChangeListener(validationChangeListener);
}
 
Example #7
Source File: OpenApi3Editor.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 5 votes vote down vote up
public OpenApi3Editor() {
    super(new OpenApi3DocumentProvider(), //
            // ZEN-4361 Missing marker location indicators (Overview Ruler) next to editor
            // scrollbar in KZOE
            new ChainedPreferenceStore(new IPreferenceStore[] { //
                    Activator.getDefault().getPreferenceStore(), //
                    // Preferences store for EditorsPlugin has settings to show/hide the rules and
                    // markers
                    EditorsPlugin.getDefault().getPreferenceStore() }));

    getPreferenceStore().addPropertyChangeListener(validationChangeListener);
}
 
Example #8
Source File: AutoStartup.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
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);
}
 
Example #9
Source File: AbstractThemeableEditor.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void initializeEditor()
{
	setPreferenceStore(new ChainedPreferenceStore(new IPreferenceStore[] {
			CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() }));
}
 
Example #10
Source File: SyntaxColoringPreferencePage.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
public SyntaxColoringPreferencePage(String title) {
    super(title);
    setPreferenceStore(EditorsPlugin.getDefault().getPreferenceStore());
    syntaxColorings = SyntaxColoringPreferencesRegistry.get().contributions();
}
 
Example #11
Source File: HTMLEditor.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public static IPreferenceStore getChainedPreferenceStore()
{
	return new ChainedPreferenceStore(new IPreferenceStore[] { HTMLPlugin.getDefault().getPreferenceStore(),
			CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}
 
Example #12
Source File: CSSSourceEditor.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public static IPreferenceStore getChainedPreferenceStore()
{
	return new ChainedPreferenceStore(new IPreferenceStore[] { CSSPlugin.getDefault().getPreferenceStore(),
			CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}
 
Example #13
Source File: DTDEditor.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public static IPreferenceStore getChainedPreferenceStore()
{
	return new ChainedPreferenceStore(new IPreferenceStore[] { DTDPlugin.getDefault().getPreferenceStore(),
			CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}
 
Example #14
Source File: JSSourceEditor.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public static IPreferenceStore getChainedPreferenceStore()
{
	return new ChainedPreferenceStore(new IPreferenceStore[] { JSPlugin.getDefault().getPreferenceStore(),
			CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}
 
Example #15
Source File: XMLEditor.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public static IPreferenceStore getChainedPreferenceStore()
{
	return new ChainedPreferenceStore(new IPreferenceStore[] { XMLPlugin.getDefault().getPreferenceStore(),
			CommonEditorPlugin.getDefault().getPreferenceStore(), EditorsPlugin.getDefault().getPreferenceStore() });
}
 
Example #16
Source File: GamlHighlightingConfiguration.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
public static GamaFont getDefaultFont() {
	final FontData fd = PreferenceConverter.getFontData(EditorsPlugin.getDefault().getPreferenceStore(),
			JFaceResources.TEXT_FONT);
	return new GamaFont(fd.getName(), fd.getStyle(), fd.getHeight());
}
 
Example #17
Source File: AutoStartup.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
public static GamaFont getDefaultFontData() {
	final FontData fd = PreferenceConverter.getFontData(EditorsPlugin.getDefault().getPreferenceStore(), TEXT_FONT);
	return new GamaFont(fd.getName(), fd.getStyle(), fd.getHeight());
}
 
Example #18
Source File: GWTJavaSpellingReconcileStrategy.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
private GWTSpellingService() {
  super(EditorsPlugin.getDefault().getPreferenceStore());
}
 
Example #19
Source File: StyledTextXtextAdapter.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
protected ISharedTextColors getSharedColors() {
	return EditorsPlugin.getDefault().getSharedTextColors();
}
 
Example #20
Source File: ModulaSearchLabelProvider.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
public void dispose() {
    super.dispose();
    PlatformUI.getPreferenceStore().removePropertyChangeListener(this);
    EditorsPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
    JFaceResources.getColorRegistry().removeListener(this);
}
 
Example #21
Source File: PktMergeViewer.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
private SourceViewerConfiguration getSourceViewerConfiguration() {
	return new DbgScriptSourceViewerConfiguration(tokenManager, EditorsPlugin.getDefault().getPreferenceStore(), DbgScriptEditor.eolCommentPrefix);
}
 
Example #22
Source File: ModulaMergeViewer.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
private SourceViewerConfiguration getSourceViewerConfiguration() {
	return new ModulaSourceViewerConfiguration(tokenManager, null, EditorsPlugin.getDefault().getPreferenceStore(), ModulaEditor.eolCommentPrefix);
}
 
Example #23
Source File: SyntaxColoringPreferencePage.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
public SyntaxColoringPreferencePage(String title, ImageDescriptor image) {
    super(title, image);
    setPreferenceStore(EditorsPlugin.getDefault().getPreferenceStore());
    syntaxColorings = SyntaxColoringPreferencesRegistry.get().contributions();
}
 
Example #24
Source File: FormatterUtils.java    From APICloud-Studio with GNU General Public License v3.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #25
Source File: FormatterUtils.java    From APICloud-Studio with GNU General Public License v3.0 2 votes vote down vote up
/**
 * 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);
}