Skip to content

Commit fb045df

Browse files
author
Jaroslav Tulach
committed
[GR-3479] Configure NetBeans to use Eclipse formatter settings.
2 parents 2857b53 + 392557d commit fb045df

File tree

1 file changed

+41
-17
lines changed

1 file changed

+41
-17
lines changed

mx.py

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11946,23 +11946,8 @@ def processDep(dep, edge):
1194611946
if files:
1194711947
files.append(projectFile)
1194811948

11949-
settingsDir = join(p.dir, ".settings")
11950-
ensure_dir_exists(settingsDir)
11951-
1195211949
# copy a possibly modified file to the project's .settings directory
11953-
for name, sources in p.eclipse_settings_sources().iteritems():
11954-
out = StringIO.StringIO()
11955-
print >> out, '# GENERATED -- DO NOT EDIT'
11956-
for source in sources:
11957-
print >> out, '# Source:', source
11958-
with open(source) as f:
11959-
print >> out, f.read()
11960-
content = out.getvalue().replace('${javaCompliance}', str(eclipseJavaCompliance))
11961-
if processors:
11962-
content = content.replace('org.eclipse.jdt.core.compiler.processAnnotations=disabled', 'org.eclipse.jdt.core.compiler.processAnnotations=enabled')
11963-
update_file(join(settingsDir, name), content)
11964-
if files:
11965-
files.append(join(settingsDir, name))
11950+
_copy_eclipse_settings(p, files)
1196611951

1196711952
if processors:
1196811953
out = XMLDoc()
@@ -12653,6 +12638,8 @@ def processDep(dep, edge):
1265312638
apSourceOutRef = ""
1265412639
ensure_dir_exists(p.output_dir())
1265512640

12641+
_copy_eclipse_settings(p)
12642+
1265612643
content = """
1265712644
annotation.processing.enabled=""" + annotationProcessorEnabled + """
1265812645
annotation.processing.enabled.in.editor=""" + annotationProcessorEnabled + """
@@ -12661,6 +12648,18 @@ def processDep(dep, edge):
1266112648
annotation.processing.run.all.processors=true
1266212649
application.title=""" + p.name + """
1266312650
application.vendor=mx
12651+
auxiliary.de-markiewb-netbeans-plugins-eclipse-formatter.eclipseFormatterActiveProfile=
12652+
auxiliary.de-markiewb-netbeans-plugins-eclipse-formatter.eclipseFormatterEnabled=true
12653+
auxiliary.de-markiewb-netbeans-plugins-eclipse-formatter.eclipseFormatterLocation=
12654+
auxiliary.de-markiewb-netbeans-plugins-eclipse-formatter.enableFormatAsSaveAction=true
12655+
auxiliary.de-markiewb-netbeans-plugins-eclipse-formatter.linefeed=
12656+
auxiliary.de-markiewb-netbeans-plugins-eclipse-formatter.preserveBreakPoints=true
12657+
auxiliary.de-markiewb-netbeans-plugins-eclipse-formatter.SaveActionModifiedLinesOnly=false
12658+
auxiliary.de-markiewb-netbeans-plugins-eclipse-formatter.showNotifications=false
12659+
auxiliary.de-markiewb-netbeans-plugins-eclipse-formatter.sourcelevel=
12660+
auxiliary.de-markiewb-netbeans-plugins-eclipse-formatter.useProjectPref=true
12661+
auxiliary.de-markiewb-netbeans-plugins-eclipse-formatter.useProjectSettings=true
12662+
auxiliary.de-markiewb-netbeans-plugins-eclipse-formatter.eclipseFormatterActiveProfile=
1266412663
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsEnabled=true
1266512664
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
1266612665
build.classes.dir=${build.dir}
@@ -14784,6 +14783,31 @@ def maven_install(args):
1478414783
for dist in arcdists:
1478514784
print 'name: ' + _map_to_maven_dist_name(dist.name) + ', path: ' + os.path.relpath(dist.path, s.dir)
1478614785

14786+
def _copy_eclipse_settings(p, files=None):
14787+
eclipseJavaCompliance = _convert_to_eclipse_supported_compliance(p.javaCompliance)
14788+
processors = p.annotation_processors()
14789+
14790+
settingsDir = join(p.dir, ".settings")
14791+
ensure_dir_exists(settingsDir)
14792+
14793+
for name, sources in p.eclipse_settings_sources().iteritems():
14794+
out = StringIO.StringIO()
14795+
print >> out, '# GENERATED -- DO NOT EDIT'
14796+
for source in sources:
14797+
print >> out, '# Source:', source
14798+
with open(source) as f:
14799+
print >> out, f.read()
14800+
if eclipseJavaCompliance:
14801+
content = out.getvalue().replace('${javaCompliance}', str(eclipseJavaCompliance))
14802+
else:
14803+
content = out.getvalue()
14804+
if processors:
14805+
content = content.replace('org.eclipse.jdt.core.compiler.processAnnotations=disabled', 'org.eclipse.jdt.core.compiler.processAnnotations=enabled')
14806+
update_file(join(settingsDir, name), content)
14807+
if files:
14808+
files.append(join(settingsDir, name))
14809+
14810+
1478714811
def ensure_dir_exists(path, mode=None):
1478814812
"""
1478914813
Ensures all directories on 'path' exists, creating them first if necessary with os.makedirs().
@@ -15743,7 +15767,7 @@ def alarm_handler(signum, frame):
1574315767
abort(1, killsig=signal.SIGINT)
1574415768

1574515769
# The comment after VersionSpec should be changed in a random manner for every bump to force merge conflicts!
15746-
version = VersionSpec("5.114.1") # JMH FTW
15770+
version = VersionSpec("5.114.2") # JST AHY
1574715771

1574815772
currentUmask = None
1574915773
_mx_start_datetime = datetime.utcnow()

0 commit comments

Comments
 (0)