This repository has been archived by the owner on Apr 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Suppport for EditorConfig files with names #61
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 0 additions & 75 deletions
75
src/main/java/com/welovecoding/nbeditorconfig/hook/EditorConfigProjectOpenedHook.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/com/welovecoding/nbeditorconfig/listener/ListenerAttacher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.welovecoding.nbeditorconfig.listener; | ||
|
||
import com.welovecoding.nbeditorconfig.config.Settings; | ||
import com.welovecoding.nbeditorconfig.processor.SmartSkip; | ||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
import org.netbeans.api.project.Project; | ||
import org.openide.filesystems.FileObject; | ||
|
||
public class ListenerAttacher { | ||
|
||
private static final Logger LOG = Logger.getLogger(ListenerAttacher.class.getSimpleName()); | ||
|
||
static { | ||
LOG.setLevel(Level.INFO); | ||
} | ||
|
||
/** | ||
* Recursively attach listeners to folders containing a .editorconfig file. | ||
* | ||
* @param file file or folder to attach listener | ||
* @param project the project the file is related to | ||
*/ | ||
public static void attachListeners(FileObject file, Project project) { | ||
if (project.getProjectDirectory().equals(file)) { | ||
file.addRecursiveListener(new ProjectChangeListener(project)); | ||
} | ||
|
||
if (file.isFolder()) { | ||
if (SmartSkip.skipDirectory(file)) { | ||
LOG.log(Level.INFO, "\u00ac Skipped directory: {0}", file.getPath()); | ||
} else { | ||
for (FileObject child : file.getChildren()) { | ||
attachListeners(child, project); | ||
} | ||
} | ||
} else { | ||
if (file.getExt().equals(Settings.EXTENSION)) { | ||
file.addFileChangeListener(new EditorConfigChangeListener(project, file)); | ||
LOG.log(Level.INFO, "\u00ac Found EditorConfig: {0}", file.getPath()); | ||
} else { | ||
LOG.log(Level.FINE, "\u00ac No EditorConfig Found: {0}", file.getPath()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt that we need the
NOI18N
declaration in a settings file because there is no translation for a MIME type, Extension and / or resource path.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think of an automatic approach of translating text within sourcecode (or at least separating). I don't think theres something wrong with that comment since the guys from the JDK for example do it the same way. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always keep it simple. There is NO automatic text translation right now and it makes NO sense to translate a MIME type. The documentation says you should use
NOI18N
when it is not completely obvious that something should not be translated and in this case it is obvious. So it's pointless to useNOI18N
here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Evidence: http://wiki.netbeans.org/TranslationFAQs#.23NOI18N