Skip to content

Commit

Permalink
Merge pull request #8 from silentsoft/dev
Browse files Browse the repository at this point in the history
Merge dev branch into master branch
  • Loading branch information
silentsoft authored Aug 9, 2020
2 parents c4c0364 + a5dc079 commit 153a4a7
Show file tree
Hide file tree
Showing 9 changed files with 1,716 additions and 79 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/plugins/
/target/
.settings/
.classpath
Expand Down
552 changes: 533 additions & 19 deletions NOTICE.md

Large diffs are not rendered by default.

35 changes: 22 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.silentsoft</groupId>
<artifactId>actlist-plugin</artifactId>
<version>2.0.1</version>
<version>2.1.0</version>

<name>actlist-plugin</name>
<description>Actlist Plugin</description>
Expand Down Expand Up @@ -38,10 +38,11 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<silentsoft-core.version>1.3.0</silentsoft-core.version>
<silentsoft-ui.version>1.2.0</silentsoft-ui.version>
<silentsoft-net.version>1.4.0</silentsoft-net.version>
<slf4j.version>1.7.5</slf4j.version>
<silentsoft-core.version>1.4.0</silentsoft-core.version>
<silentsoft-io.version>1.3.0</silentsoft-io.version>
<silentsoft-ui.version>1.3.0</silentsoft-ui.version>
<silentsoft-net.version>1.5.0</silentsoft-net.version>
<logback.version>1.2.3</logback.version>
<junit.version>4.8.1</junit.version>
<testfx.version>4.0.15-alpha</testfx.version>
<maven-model.version>3.6.0</maven-model.version>
Expand All @@ -50,6 +51,7 @@
<plushaze-traynotification.tag>5393c3a54f</plushaze-traynotification.tag>
<javassist.version>3.26.0-GA</javassist.version>
<commonmark.version>0.13.1</commonmark.version>
<notice-file-generator.version>2.2.2</notice-file-generator.version>
</properties>

<repositories>
Expand All @@ -73,6 +75,7 @@
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
Expand Down Expand Up @@ -161,6 +164,11 @@
<artifactId>silentsoft-core</artifactId>
<version>${silentsoft-core.version}</version>
</dependency>
<dependency>
<groupId>org.silentsoft</groupId>
<artifactId>silentsoft-io</artifactId>
<version>${silentsoft-io.version}</version>
</dependency>
<dependency>
<groupId>org.silentsoft</groupId>
<artifactId>silentsoft-ui</artifactId>
Expand All @@ -172,14 +180,9 @@
<version>${silentsoft-net.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down Expand Up @@ -223,6 +226,12 @@
<artifactId>commonmark</artifactId>
<version>${commonmark.version}</version>
</dependency>
<dependency>
<groupId>org.silentsoft.oss</groupId>
<artifactId>notice-file-generator</artifactId>
<version>${notice-file-generator.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<distributionManagement>
Expand Down
107 changes: 81 additions & 26 deletions src/main/java/org/silentsoft/actlist/plugin/DebugApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicNameValuePair;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.commonmark.parser.Parser;
Expand All @@ -67,13 +65,16 @@
import org.silentsoft.core.util.JSONUtil;
import org.silentsoft.core.util.ObjectUtil;
import org.silentsoft.core.util.SystemUtil;
import org.silentsoft.ui.model.Delta;
import org.slf4j.LoggerFactory;

import com.github.markusbernhardt.proxy.ProxySearch;
import com.github.plushaze.traynotification.animations.Animations;
import com.jfoenix.controls.JFXHamburger;
import com.jfoenix.controls.JFXSpinner;
import com.jfoenix.controls.JFXToggleButton;

import ch.qos.logback.classic.Level;
import de.codecentric.centerdevice.glass.AdapterContext;
import javafx.animation.FadeTransition;
import javafx.application.Application;
Expand Down Expand Up @@ -322,25 +323,34 @@ public void edit(FieldAccess fieldAccess) throws CannotCompileException {
}
}

if (ActlistPlugin.class.isAssignableFrom(Class.forName(ctClass.getName()))) {
CtMethod[] ctMethods = ctClass.getDeclaredMethods();
if (ctMethods != null) {
for (CtMethod ctMethod : ctMethods) {
for (CtMethod superMethod : ctActlistPlugin.getDeclaredMethods()) {
if (superMethod.equals(ctMethod)) {
references.add(superMethod.getLongName());

if (debugParameter.getAnalysisIgnoreReferences() != null) {
if (Arrays.asList(debugParameter.getAnalysisIgnoreReferences()).contains(superMethod.getLongName())) {
continue;
}
}
if (superMethod.hasAnnotation(CompatibleVersion.class)) {
String value = ((CompatibleVersion) superMethod.getAnnotation(CompatibleVersion.class)).value();
{
wrappers.add(new Wrapper(value, String.format("%s override <%s>", ctClass.getName(), superMethod.getLongName())));
Class<?> clazz = null;
try {
clazz = Class.forName(ctClass.getName());
} catch (Throwable e) {

} finally {
if (clazz != null) {
if (ActlistPlugin.class.isAssignableFrom(clazz)) {
CtMethod[] ctMethods = ctClass.getDeclaredMethods();
if (ctMethods != null) {
for (CtMethod ctMethod : ctMethods) {
for (CtMethod superMethod : ctActlistPlugin.getDeclaredMethods()) {
if (superMethod.equals(ctMethod)) {
references.add(superMethod.getLongName());

if (debugParameter.getAnalysisIgnoreReferences() != null) {
if (Arrays.asList(debugParameter.getAnalysisIgnoreReferences()).contains(superMethod.getLongName())) {
continue;
}
}
if (superMethod.hasAnnotation(CompatibleVersion.class)) {
String value = ((CompatibleVersion) superMethod.getAnnotation(CompatibleVersion.class)).value();
{
wrappers.add(new Wrapper(value, String.format("%s override <%s>", ctClass.getName(), superMethod.getLongName())));
}
comparator.accept(value);
}
}
comparator.accept(value);
}
}
}
Expand Down Expand Up @@ -377,7 +387,7 @@ public void edit(FieldAccess fieldAccess) throws CannotCompileException {
}

private static void updateLoggingLevel(DebugParameter debugParameter) {
LogManager.getRootLogger().setLevel((Level.toLevel(debugParameter.getLoggingLevel())));
((ch.qos.logback.classic.Logger) LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME)).setLevel(Level.toLevel(debugParameter.getLoggingLevel()));
}

private static void updateProxyHost() {
Expand Down Expand Up @@ -1335,6 +1345,13 @@ private HBox createToggleBox() {
if (existsContent) {
WebView webView = new WebView();
{
Consumer<String> loadContent = (raw) -> {
String content = HtmlRenderer.builder().build().render(Parser.builder().build().parse(raw));

webView.getEngine().setUserStyleSheetLocation(getClass().getResource("/github-markdown.css").toExternalForm());
webView.getEngine().loadContent(String.format("<article class='markdown-body'>%s</article>", content));
};

BufferedReader reader = null;
try {
if (ObjectUtil.isNotEmpty(uri)) {
Expand All @@ -1344,14 +1361,13 @@ private HBox createToggleBox() {
for (String value=null; (value=reader.readLine()) != null; ) {
buffer.append(value.concat("\r\n"));
}
String content = HtmlRenderer.builder().build().render(Parser.builder().build().parse(buffer.toString()));
webView.getEngine().loadContent(content);

loadContent.accept(buffer.toString());
} else {
webView.getEngine().load(uri.toString());
}
} else if (ObjectUtil.isNotEmpty(text)) {
String content = HtmlRenderer.builder().build().render(Parser.builder().build().parse(text));
webView.getEngine().loadContent(content);
loadContent.accept(text);
}
} catch (Exception e) {
e.printStackTrace();
Expand Down Expand Up @@ -1557,10 +1573,49 @@ private void loadPluginGraphic() {
if (pluginContent != null) {
VBox contentBox = (VBox) stage.getScene().lookup("#contentBox");

contentBox.getChildren().add(new BorderPane(pluginContent));
BorderPane pluginPane = new BorderPane(pluginContent);
BorderPane.setAlignment(pluginContent, Pos.TOP_CENTER);
contentBox.getChildren().add(pluginPane);

Separator contentLine = new Separator();
contentLine.setPrefWidth(215.0);
contentLine.setPadding(new Insets(5.0, 0.0, 0.0, 0.0));
contentLine.setCursor(Cursor.V_RESIZE);
{
AtomicReference<Double> initialHeight = new AtomicReference<>(null);
Delta dragDelta = new Delta();

contentLine.setOnMousePressed(mouseEvent -> {
if (mouseEvent.getButton() == MouseButton.PRIMARY) {
if (initialHeight.get() == null) {
initialHeight.set(pluginPane.getHeight());
}

dragDelta.setHeight(pluginPane.getHeight());
dragDelta.setY(mouseEvent.getScreenY());

if (mouseEvent.getClickCount() >= 2) {
pluginPane.setMinHeight(initialHeight.get());
pluginPane.setMaxHeight(initialHeight.get());

contentLine.setCursor(Cursor.V_RESIZE);
}
}
});
contentLine.setOnMouseDragged(mouseEvent -> {
if (mouseEvent.getButton() == MouseButton.PRIMARY) {
double height = dragDelta.getHeight() + (mouseEvent.getScreenY() - dragDelta.getY());
if (height >= initialHeight.get()) {
pluginPane.setMinHeight(height);
pluginPane.setMaxHeight(height);

contentLine.setCursor(Cursor.V_RESIZE);
} else {
contentLine.setCursor(Cursor.CLOSED_HAND);
}
}
});
}
contentBox.getChildren().add(contentLine);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public String[] getAnalysisIgnoreReferences() {
return analysisIgnoreReferences;
}

@CompatibleVersion("2.0.0")
@CompatibleVersion("2.0.1")
public String getLoggingLevel() {
return loggingLevel;
}
Expand All @@ -85,7 +85,7 @@ private DebugParameterBuilder() {
this.shouldAnalyze = true;
this.classesDirectoryToAnalyze = Paths.get("target", "classes");
this.analysisIgnoreReferences = null;
this.loggingLevel = "TRACE";
this.loggingLevel = "DEBUG";
}

/**
Expand Down Expand Up @@ -158,7 +158,7 @@ public DebugParameterBuilder setAnalysisIgnoreReferences(String[] analysisIgnore
* @param loggingLevel e.g. <code>TRACE, DEBUG, INFO, WARN, ERROR</code>
* @return
*/
@CompatibleVersion("2.0.0")
@CompatibleVersion("2.0.1")
public DebugParameterBuilder setLoggingLevel(String loggingLevel) {
this.loggingLevel = loggingLevel;

Expand Down
Loading

0 comments on commit 153a4a7

Please sign in to comment.