Skip to content

Commit

Permalink
isEnabled(UIContext) is final and delegates to isEnabled(ShellContext)
Browse files Browse the repository at this point in the history
to ensure shell-only behavior
  • Loading branch information
gastaldi committed Aug 27, 2013
1 parent 911c554 commit 38a47a9
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
public abstract class AbstractShellCommand extends AbstractUICommand
{
@Override
public boolean isEnabled(UIContext context)
public Metadata getMetadata()
{
return context instanceof ShellContext;
return super.getMetadata().category(Categories.create("Shell"));
}

@Override
public Metadata getMetadata()
public final boolean isEnabled(UIContext context)
{
return super.getMetadata().category(Categories.create("Shell"));
return (context instanceof ShellContext) && isEnabled((ShellContext) context);
}

@Override
Expand All @@ -38,5 +38,11 @@ public final Result execute(UIContext context) throws Exception
return execute((ShellContext) context);
}

// This method is meant to be overriden
public boolean isEnabled(ShellContext context)
{
return true;
}

public abstract Result execute(ShellContext shellContext) throws Exception;
}

0 comments on commit 38a47a9

Please sign in to comment.