Skip to content

Commit

Permalink
Provide .editorconfig support
Browse files Browse the repository at this point in the history
Fixes #87

Signed-off-by: azerr <[email protected]>
  • Loading branch information
angelozerr committed Sep 19, 2022
1 parent 81e0abc commit 433f4fe
Show file tree
Hide file tree
Showing 25 changed files with 1,999 additions and 5 deletions.
9 changes: 9 additions & 0 deletions org.eclipse.text.editorconfig/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/ec4j-core-0.3.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/ec4j-ide-support-0.3.0.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 2 additions & 0 deletions org.eclipse.text.editorconfig/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/bin
/target
28 changes: 28 additions & 0 deletions org.eclipse.text.editorconfig/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.text.editorconfig</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>
317 changes: 317 additions & 0 deletions org.eclipse.text.editorconfig/.settings/org.eclipse.jdt.core.prefs

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions org.eclipse.text.editorconfig/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.editorconfig;singleton:=true
Bundle-Version: 0.1.0.qualifier
Require-Bundle: org.eclipse.jface.text,
org.eclipse.core.runtime,
org.eclipse.ui,
org.eclipse.core.resources,
org.eclipse.core.filesystem,
org.eclipse.ui.ide;bundle-version="3.12.0",
org.eclipse.ui.editors
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-Activator: org.eclipse.text.editorconfig.EditorConfigPlugin
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: lib/ec4j-core-0.3.0.jar,
lib/ec4j-ide-support-0.3.0.jar,
.

10 changes: 10 additions & 0 deletions org.eclipse.text.editorconfig/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
source.. = src/main/java/,\
src/main/resources/,\
src/test/resources
bin.includes = META-INF/,\
.,\
plugin.properties,\
plugin.xml,\
lib/ec4j-core-0.3.0.jar,\
lib/ec4j-ide-support-0.3.0.jar

Binary file not shown.
Binary file not shown.
15 changes: 15 additions & 0 deletions org.eclipse.text.editorconfig/plugin.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
###############################################################################
# Copyright (c) 2022 Angelo Zerr and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Angelo Zerr <[email protected]> - Initial API and implementation
###############################################################################
pluginName=Support for editorconfig in Eclipse text editors
providerName= Eclipse.org
56 changes: 56 additions & 0 deletions org.eclipse.text.editorconfig/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<!--
###############################################################################
# Copyright (c) 2022 Angelo Zerr and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Angelo Zerr <[email protected]> - Initial API and implementation
###############################################################################
-->
<plugin>

<!-- EditorConfig -->

<extension
point="org.eclipse.core.contenttype.contentTypes">
<content-type
base-type="org.eclipse.core.runtime.text"
id="org.eclipse.text.editorconfig"
file-names=".editorconfig"
name="EditorConfig"
priority="normal"/>
</extension>

<extension
point="org.eclipse.ui.editors">
<editorContentTypeBinding
contentTypeId="org.eclipse.text.editorconfig"
editorId="org.eclipse.ui.genericeditor.GenericEditor">
</editorContentTypeBinding>
</extension>

<extension
point="org.eclipse.ui.startup">
<startup class="org.eclipse.text.editorconfig.internal.EditorConfigStartup" />
</extension>

<extension
point="org.eclipse.core.runtime.adapters">
<factory
adaptableType="org.eclipse.ui.texteditor.ITextEditor"
class="org.eclipse.text.editorconfig.internal.EditorConfigPreferenceStoreAdapter">
<adapter
type="org.eclipse.core.runtime.preferences.IEclipsePreferences">
</adapter>
</factory>
</extension>

</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* Copyright (c) 2017 Angelo ZERR.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Angelo Zerr <[email protected]> - initial API and implementation
*/
package org.eclipse.text.editorconfig;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

/**
* The activator class controls the plug-in life cycle
*/
public class EditorConfigPlugin extends AbstractUIPlugin {

// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.text.editorconfig"; //$NON-NLS-1$

// The shared instance
private static EditorConfigPlugin plugin;

/**
* The constructor
*/
public EditorConfigPlugin() {
}

@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
IDEEditorConfigManager.getInstance().init();
}

@Override
public void stop(BundleContext context) throws Exception {
IDEEditorConfigManager.getInstance().dispose();
plugin = null;
super.stop(context);
}

/**
* Returns the shared instance
*
* @return the shared instance
*/
public static EditorConfigPlugin getDefault() {
return plugin;
}

/**
* Utility method to log errors.
*
* @param thr
* The exception through which we noticed the error
*/
public static void logError(final Throwable thr) {
getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, 0, thr.getMessage(), thr));
}

/**
* Utility method to log errors.
*
* @param message
* User comprehensible message
* @param thr
* The exception through which we noticed the error
*/
public static void logError(final String message, final Throwable thr) {
getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, 0, message, thr));
}

}
Loading

0 comments on commit 433f4fe

Please sign in to comment.