-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from oroinc/ticket/OPP-75
OPP-75: Replace methods, classes and constants marked for removal
- Loading branch information
Showing
55 changed files
with
554 additions
and
351 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
*.iml | ||
build/ | ||
.idea-sandbox/ | ||
.DS_Store | ||
.DS_Store | ||
config/extra-settings.gradle.kts |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
val pathToIde by extra("/path/to/your/phpstorm/ide") | ||
val javaLanguageVersionSetting by extra("17") |
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
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
49 changes: 28 additions & 21 deletions
49
src/main/java/com/oroplatform/idea/oroplatform/intellij/OroNotifications.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 |
---|---|---|
@@ -1,43 +1,50 @@ | ||
package com.oroplatform.idea.oroplatform.intellij; | ||
|
||
import com.intellij.notification.Notification; | ||
import com.intellij.notification.NotificationGroup; | ||
import com.intellij.notification.NotificationType; | ||
import com.intellij.notification.Notifications; | ||
import com.intellij.notification.*; | ||
import com.intellij.openapi.actionSystem.AnActionEvent; | ||
import com.intellij.openapi.project.Project; | ||
import com.oroplatform.idea.oroplatform.OroPlatformBundle; | ||
import com.oroplatform.idea.oroplatform.settings.OroPlatformSettings; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
class OroNotifications { | ||
private final static NotificationGroup GROUP = NotificationGroup.balloonGroup(OroPlatformBundle.message("notifications.group")); | ||
private final static NotificationGroup GROUP = NotificationGroupManager | ||
.getInstance() | ||
.getNotificationGroup("Oro Notifications"); | ||
|
||
static void showPluginEnableNotification(@NotNull final Project project) { | ||
final Notification notification = GROUP.createNotification( | ||
OroPlatformBundle.message("notifications.enablePluginTitle"), | ||
OroPlatformBundle.message("notifications.enablePlugin"), | ||
NotificationType.INFORMATION, | ||
(thisNotification, event) -> { | ||
thisNotification.expire(); | ||
OroPlatformBundle.message("notifications.enablePluginTitle"), | ||
OroPlatformBundle.message("notifications.enablePlugin"), | ||
NotificationType.INFORMATION); | ||
|
||
final OroPlatformSettings settings = OroPlatformSettings.getInstance(project); | ||
final OroPlatformSettings settings = OroPlatformSettings.getInstance(project); | ||
|
||
if("enable".equals(event.getDescription())) { | ||
settings.setPluginEnabled(true); | ||
showPluginEnabledNotification(project); | ||
} else if("dismiss".equals(event.getDescription())) { | ||
settings.setPluginEnableDismissed(true); | ||
} | ||
}); | ||
notification.addAction(new NotificationAction(OroPlatformBundle.message("notifications.enablePlugin.accept")) { | ||
@Override | ||
public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) { | ||
notification.expire(); | ||
settings.setPluginEnabled(true); | ||
showPluginEnabledNotification(project); | ||
} | ||
}); | ||
|
||
notification.addAction(new NotificationAction( | ||
OroPlatformBundle.message("notifications.enablePlugin.dismiss")) { | ||
@Override | ||
public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) { | ||
notification.expire(); | ||
settings.setPluginEnableDismissed(true); | ||
} | ||
}); | ||
Notifications.Bus.notify(notification, project); | ||
} | ||
|
||
private static void showPluginEnabledNotification(@NotNull final Project project) { | ||
Notifications.Bus.notify(GROUP.createNotification( | ||
OroPlatformBundle.message("notifications.group"), | ||
OroPlatformBundle.message("notifications.pluginEnabled"), | ||
NotificationType.INFORMATION, null | ||
OroPlatformBundle.message("notifications.group"), | ||
OroPlatformBundle.message("notifications.pluginEnabled"), | ||
NotificationType.INFORMATION | ||
), project); | ||
} | ||
} |
51 changes: 15 additions & 36 deletions
51
src/main/java/com/oroplatform/idea/oroplatform/intellij/ProjectConfigurator.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 |
---|---|---|
@@ -1,53 +1,32 @@ | ||
package com.oroplatform.idea.oroplatform.intellij; | ||
|
||
import com.intellij.openapi.components.ProjectComponent; | ||
import com.intellij.openapi.project.Project; | ||
import com.intellij.openapi.project.ProjectUtil; | ||
import com.intellij.openapi.startup.ProjectActivity; | ||
import com.intellij.openapi.vfs.VfsUtil; | ||
import com.oroplatform.idea.oroplatform.settings.OroPlatformSettings; | ||
import kotlin.Unit; | ||
import kotlin.coroutines.Continuation; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class ProjectConfigurator implements ProjectComponent { | ||
|
||
private final Project project; | ||
|
||
public ProjectConfigurator(@NotNull Project project) { | ||
this.project = project; | ||
} | ||
public class ProjectConfigurator implements ProjectActivity { | ||
|
||
@Nullable | ||
@Override | ||
public void projectOpened() { | ||
if(couldPluginBeEnabled()) { | ||
public Object execute(@NotNull Project project, @NotNull Continuation<? super Unit> continuation) { | ||
if(couldPluginBeEnabled(project)) { | ||
OroNotifications.showPluginEnableNotification(project); | ||
} | ||
return continuation; | ||
} | ||
|
||
private boolean couldPluginBeEnabled() { | ||
return isOroPlatformDetected() && OroPlatformSettings.getInstance(project).couldPluginBeEnabled(); | ||
} | ||
|
||
private boolean isOroPlatformDetected() { | ||
return VfsUtil.findRelativeFile(project.getBaseDir(), "vendor", "oro", "platform") != null || | ||
VfsUtil.findRelativeFile(project.getBaseDir(), "package", "platform", "src", "Oro") != null; | ||
} | ||
|
||
@Override | ||
public void projectClosed() { | ||
|
||
} | ||
|
||
@Override | ||
public void initComponent() { | ||
|
||
private boolean couldPluginBeEnabled(@NotNull Project project) { | ||
return isOroPlatformDetected(project) && OroPlatformSettings.getInstance(project).couldPluginBeEnabled(); | ||
} | ||
|
||
@Override | ||
public void disposeComponent() { | ||
|
||
} | ||
|
||
@NotNull | ||
@Override | ||
public String getComponentName() { | ||
return "ProjectConfigurator"; | ||
private boolean isOroPlatformDetected(@NotNull Project project) { | ||
return VfsUtil.findRelativeFile(ProjectUtil.guessProjectDir(project), "vendor", "oro", "platform") != null || | ||
VfsUtil.findRelativeFile(ProjectUtil.guessProjectDir(project), "package", "platform", "src", "Oro") != null; | ||
} | ||
} |
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
Oops, something went wrong.