-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
...addon/src/main/java/org/jboss/forge/addons/envers/commands/JpaEntityCreationListener.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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.jboss.forge.addons.envers.commands; | ||
|
||
import org.jboss.forge.addon.configuration.Configuration; | ||
import org.jboss.forge.addon.configuration.facets.ConfigurationFacet; | ||
import org.jboss.forge.addon.projects.ProjectFactory; | ||
import org.jboss.forge.addon.projects.Projects; | ||
import org.jboss.forge.addon.ui.command.CommandExecutionListener; | ||
import org.jboss.forge.addon.ui.command.UICommand; | ||
import org.jboss.forge.addon.ui.context.UIExecutionContext; | ||
import org.jboss.forge.addon.ui.context.UISelection; | ||
import org.jboss.forge.addon.ui.result.Result; | ||
|
||
import javax.inject.Inject; | ||
|
||
/** | ||
* @author Ivan St. Ivanov | ||
*/ | ||
public class JpaEntityCreationListener implements CommandExecutionListener | ||
{ | ||
@Override public void preCommandExecuted(UICommand uiCommand, UIExecutionContext uiExecutionContext) | ||
{ | ||
|
||
} | ||
|
||
@Inject | ||
private ProjectFactory projectFactory; | ||
|
||
@Override public void postCommandExecuted(UICommand uiCommand, UIExecutionContext uiExecutionContext, Result result) | ||
{ | ||
String commandName = uiCommand | ||
.getMetadata(uiExecutionContext.getUIContext()) | ||
.getName(); | ||
if (commandName.equals("JPA: New Entity") && projectFactory != null) | ||
{ | ||
|
||
Configuration configuration = Projects | ||
.getSelectedProject(projectFactory, uiExecutionContext.getUIContext()) | ||
.getFacet(ConfigurationFacet.class) | ||
.getConfiguration(); | ||
if ((Boolean) configuration.getProperty(Constants.AUTO_AUDIT_CONFIG_ENTRY)) | ||
{ | ||
uiExecutionContext.getUIContext().getSelection(); | ||
} | ||
|
||
} | ||
} | ||
|
||
@Override public void postCommandFailure(UICommand uiCommand, UIExecutionContext uiExecutionContext, | ||
Throwable throwable) | ||
{ | ||
|
||
} | ||
} |