Skip to content

Commit 07781e2

Browse files
author
gbr
committed
Refactor startup code, including part and property tracking.
1 parent 80492fa commit 07781e2

File tree

28 files changed

+763
-325
lines changed

28 files changed

+763
-325
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Ignore certain Eclipse related files
2-
.classpath
32
.settings/
43
bin/
54
target/

.mvn/extensions.xml

-8
This file was deleted.

.project

+6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
<projects>
66
</projects>
77
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.m2e.core.maven2Builder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
813
</buildSpec>
914
<natures>
15+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
1016
</natures>
1117
</projectDescription>

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## The MIT License
22

3-
Copyright (c) 2006-2018 The IndentGuide Authors.
3+
Copyright (c) 2006-2023 The IndentGuide Authors.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

net.certiv.tools.indentguide.feature/.project

+12
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,19 @@
55
<projects>
66
</projects>
77
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.pde.FeatureBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
818
</buildSpec>
919
<natures>
20+
<nature>org.eclipse.pde.FeatureNature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
1022
</natures>
1123
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
4+
<attributes>
5+
<attribute name="module" value="true"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
9+
<classpathentry kind="output" path="target/classes"/>
10+
</classpath>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>net.certiv.tools.indentguide.plugin.test</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.pde.ManifestBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.pde.SchemaBuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>org.eclipse.m2e.core.maven2Builder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
</buildSpec>
29+
<natures>
30+
<nature>org.eclipse.jdt.core.javanature</nature>
31+
<nature>org.eclipse.pde.PluginNature</nature>
32+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
33+
</natures>
34+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Manifest-Version: 1.0
2+
Bundle-ManifestVersion: 2
3+
Bundle-Name: tychotest.test
4+
Bundle-Vendor: tychotest
5+
Bundle-SymbolicName: net.certiv.tools.indentguide.plugin.test
6+
Bundle-Version: 2.1.0.qualifier
7+
Fragment-Host: net.certiv.tools.indentguide;bundle-version="2.1.0.qualifier"
8+
Bundle-RequiredExecutionEnvironment: JavaSE-11
9+
Require-Bundle: junit-jupiter-api
10+
Automatic-Module-Name: tychotest.test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bin.includes = META-INF/,\
2+
.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
5+
<modelVersion>4.0.0</modelVersion>
6+
<packaging>eclipse-test-plugin</packaging>
7+
8+
<parent>
9+
<groupId>net.certiv</groupId>
10+
<artifactId>net.certiv.tools.indentguide.parent</artifactId>
11+
<version>2.1.0-SNAPSHOT</version>
12+
</parent>
13+
14+
<artifactId>net.certiv.tools.indentguide.plugin.test</artifactId>
15+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package net.certiv.tools.indentguide;
2+
3+
import org.junit.jupiter.api.Assertions;
4+
import org.junit.jupiter.api.Test;
5+
6+
public class ActivatorTest {
7+
8+
@Test
9+
public void testActivatorId() {
10+
Assertions.assertNotNull(Activator.PLUGIN_ID);
11+
}
12+
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
4+
<attributes>
5+
<attribute name="module" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
10+
<classpathentry kind="src" path="src/main/java"/>
11+
<classpathentry kind="output" path="target/classes"/>
12+
</classpath>

net.certiv.tools.indentguide.plugin/build.properties

-2
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@ bin.includes = plugin.xml,\
55
META-INF/,\
66
OSGI-INF/,\
77
icons/
8-
src.excludes = src/test/java/,\
9-
src/test/resources/

net.certiv.tools.indentguide.plugin/src/main/java/net/certiv/tools/indentguide/Activator.java

+21-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static Activator getDefault() {
3535
public void start(BundleContext context) throws Exception {
3636
super.start(context);
3737
plugin = this;
38-
log("Startup");
38+
log("Starting...");
3939
}
4040

4141
@Override
@@ -44,15 +44,31 @@ public void stop(BundleContext context) throws Exception {
4444
super.stop(context);
4545
}
4646

47+
// ------------------------------------------
48+
49+
public static void log(Throwable e) {
50+
plugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, e.getMessage()));
51+
}
52+
4753
public static void log(String fmt, Object... args) {
48-
plugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, PREFIX + String.format(fmt, args)));
54+
String msg = print(PREFIX + String.format(fmt, args));
55+
plugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, msg));
4956
}
5057

5158
public static void log(MsgBuilder mb) {
52-
plugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, PREFIX + mb.toString()));
59+
String msg = print(PREFIX + mb.toString());
60+
plugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, msg));
5361
}
5462

55-
public static void log(Throwable e) {
56-
plugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, e.getMessage()));
63+
private static String print(String msg) {
64+
StackTraceElement caller = Thread.currentThread().getStackTrace()[3];
65+
return info(caller.getClassName(), caller.getLineNumber(), msg);
66+
}
67+
68+
private static String info(String clsname, int line, String msg) {
69+
if (clsname.startsWith(PLUGIN_ID)) {
70+
clsname = clsname.substring(PLUGIN_ID.length() + 1);
71+
}
72+
return String.format("%s:%s \t%s", clsname, line, msg);
5773
}
5874
}

0 commit comments

Comments
 (0)