Skip to content

Commit ef01577

Browse files
committed
Merge branch 'master' into master2
# Conflicts: # src/main/resources/META-INF/plugin.xml
2 parents cfedaf1 + 85fdc65 commit ef01577

File tree

6 files changed

+40
-33
lines changed

6 files changed

+40
-33
lines changed

Material Theme.zip

-935 Bytes
Binary file not shown.

src/main/java/com/chrisrm/idea/MTConfig.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,26 @@ public void loadState(MTConfig state) {
117117
XmlSerializerUtil.copyBean(state, this);
118118
}
119119

120+
/**
121+
* Fire an event to the application bus that the settings have changed
122+
*
123+
* @param form
124+
*/
125+
public void fireBeforeChanged(MTForm form) {
126+
ApplicationManager.getApplication().getMessageBus()
127+
.syncPublisher(BeforeConfigNotifier.BEFORE_CONFIG_TOPIC)
128+
.beforeConfigChanged(this, form);
129+
}
130+
131+
/**
132+
* Fire an event to the application bus that the settings have changed
133+
*/
134+
public void fireChanged() {
135+
ApplicationManager.getApplication().getMessageBus()
136+
.syncPublisher(ConfigNotifier.CONFIG_TOPIC)
137+
.configChanged(this);
138+
}
139+
120140
/**
121141
* Get the set highlight color
122142
*
@@ -240,26 +260,6 @@ public boolean isBoldTabsChanged(boolean isBoldTabs) {
240260
return this.isBoldTabs != isBoldTabs;
241261
}
242262

243-
/**
244-
* Fire an event to the application bus that the settings have changed
245-
*
246-
* @param form
247-
*/
248-
public void fireBeforeChanged(MTForm form) {
249-
ApplicationManager.getApplication().getMessageBus()
250-
.syncPublisher(BeforeConfigNotifier.BEFORE_CONFIG_TOPIC)
251-
.beforeConfigChanged(this, form);
252-
}
253-
254-
/**
255-
* Fire an event to the application bus that the settings have changed
256-
*/
257-
public void fireChanged() {
258-
ApplicationManager.getApplication().getMessageBus()
259-
.syncPublisher(ConfigNotifier.CONFIG_TOPIC)
260-
.configChanged(this);
261-
}
262-
263263
public boolean getIsBoldTabs() {
264264
return isBoldTabs;
265265
}

src/main/java/com/chrisrm/idea/MTTheme.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public Color getDisabledColor() {
7272
return ColorUtil.fromHex(properties.getProperty("material.disabled"));
7373
}
7474

75+
@NotNull
7576
public String getEditorColorsScheme() {
7677
return editorColorsScheme;
7778
}

src/main/java/com/chrisrm/idea/themes/MTLafComponent.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.chrisrm.idea.messages.MaterialThemeBundle;
88
import com.chrisrm.idea.ui.*;
99
import com.chrisrm.idea.utils.UIReplacer;
10-
import com.intellij.ide.AppLifecycleListener;
1110
import com.intellij.ide.ui.LafManager;
1211
import com.intellij.openapi.actionSystem.impl.ActionToolbarImpl;
1312
import com.intellij.openapi.application.Application;
@@ -16,6 +15,8 @@
1615
import com.intellij.openapi.components.ApplicationComponent;
1716
import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx;
1817
import com.intellij.openapi.project.Project;
18+
import com.intellij.openapi.project.ProjectManager;
19+
import com.intellij.openapi.project.ProjectManagerListener;
1920
import com.intellij.openapi.ui.Messages;
2021
import com.intellij.openapi.wm.WindowManager;
2122
import com.intellij.openapi.wm.impl.status.IdeStatusBarImpl;
@@ -59,7 +60,6 @@ public void initComponent() {
5960
connect = ApplicationManager.getApplication().getMessageBus().connect();
6061
connect.subscribe(ConfigNotifier.CONFIG_TOPIC, this::onSettingsChanged);
6162
connect.subscribe(BeforeConfigNotifier.BEFORE_CONFIG_TOPIC, (this::onBeforeSettingsChanged));
62-
6363
}
6464

6565
/**
@@ -72,18 +72,20 @@ public static void hackTitleLabel() {
7272
ClassPool cp = new ClassPool(true);
7373
cp.insertClassPath(new ClassClassPath(CaptionPanel.class));
7474
CtClass ctClass = cp.get("com.intellij.ui.TitlePanel");
75-
CtConstructor declaredConstructor = ctClass.getDeclaredConstructor(new CtClass[]{cp.get("javax.swing.Icon"), cp.get("javax.swing" +
76-
".Icon")});
75+
CtConstructor declaredConstructor = ctClass.getDeclaredConstructor(new CtClass[] {cp.get("javax.swing.Icon"), cp.get("javax.swing" +
76+
".Icon")});
7777
declaredConstructor.instrument(new ExprEditor() {
7878
@Override
7979
public void edit(MethodCall m) throws CannotCompileException {
8080
if (m.getMethodName().equals("empty")) {
8181
// Replace insets
8282
m.replace("{ $1 = 10; $2 = 10; $3 = 10; $4 = 10; $_ = $proceed($$); }");
83-
} else if (m.getMethodName().equals("setHorizontalAlignment")) {
83+
}
84+
else if (m.getMethodName().equals("setHorizontalAlignment")) {
8485
// Set title at the left
8586
m.replace("{ $1 = javax.swing.SwingConstants.LEFT; $_ = $proceed($$); }");
86-
} else if (m.getMethodName().equals("setBorder")) {
87+
}
88+
else if (m.getMethodName().equals("setBorder")) {
8789
// Bigger heading
8890
m.replace("{ $_ = $proceed($$); myLabel.setFont(myLabel.getFont().deriveFont(1, com.intellij.util.ui.JBUI.scale(16.0f))); }");
8991
}
@@ -96,7 +98,6 @@ public void edit(MethodCall m) throws CannotCompileException {
9698
}
9799
}
98100

99-
100101
@Override
101102
public void disposeComponent() {
102103
connect.disconnect();
@@ -163,7 +164,8 @@ private void restartIde() {
163164
Application application = ApplicationManager.getApplication();
164165
if (application instanceof ApplicationImpl) {
165166
((ApplicationImpl) application).restart(true);
166-
} else {
167+
}
168+
else {
167169
application.restart();
168170
}
169171
}
@@ -178,7 +180,7 @@ private static void hackSearchTextField() throws NotFoundException, CannotCompil
178180

179181
CtClass darculaClass = cp.get("com.intellij.ide.ui.laf.darcula.ui.DarculaTextFieldUI");
180182
CtClass componentClass = cp.get("javax.swing.JComponent");
181-
CtMethod createUI = darculaClass.getDeclaredMethod("createUI", new CtClass[]{componentClass});
183+
CtMethod createUI = darculaClass.getDeclaredMethod("createUI", new CtClass[] {componentClass});
182184
createUI.setBody("{ return com.chrisrm.idea.ui.MTTextFieldFactory.newInstance($1); }");
183185
darculaClass.toClass();
184186
}
@@ -248,9 +250,10 @@ private void replaceStatusBar() {
248250
MessageBusConnection connect = ApplicationManager.getApplication().getMessageBus().connect();
249251

250252
// On app init, set the statusbar borders
251-
connect.subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener() {
253+
connect.subscribe(ProjectManager.TOPIC, new ProjectManagerListener() {
254+
252255
@Override
253-
public void appStarting(@Nullable Project projectFromCommandLine) {
256+
public void projectOpened(@Nullable Project projectFromCommandLine) {
254257
boolean compactSidebar = MTConfig.getInstance().isCompactStatusBar();
255258
setStatusBarBorders(compactSidebar);
256259
}
@@ -261,7 +264,6 @@ public void appStarting(@Nullable Project projectFromCommandLine) {
261264
boolean compactSidebar = mtConfig.isCompactStatusBar();
262265
setStatusBarBorders(compactSidebar);
263266
});
264-
265267
}
266268

267269
private void setStatusBarBorders(boolean compactSidebar) {

src/main/java/com/chrisrm/idea/themes/MTThemeManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ public void activate() {
150150
* @param mtTheme
151151
*/
152152
public void activate(MTTheme mtTheme) {
153+
if (mtTheme == null) {
154+
mtTheme = MTTheme.DEFAULT;
155+
}
156+
153157
MTConfig.getInstance().setSelectedTheme(mtTheme);
154158

155159
try {

src/main/resources/META-INF/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<idea-plugin>
22
<id>com.chrisrm.idea.MaterialThemeUI</id>
33
<name>Material Theme UI</name>
4-
<version>0.5.3.2</version>
4+
<version>0.5.3.4</version>
55
<vendor email="chris@hirvi.no" url="https://hirvi.no">Hirvi AS</vendor>
66

77
<description><![CDATA[

0 commit comments

Comments
 (0)