Skip to content

Commit

Permalink
FORGE-2379: Introduced UIProvider.getName()
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Jun 29, 2015
1 parent 57659a6 commit f246915
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -341,4 +341,10 @@ public UIDesktop getDesktop()
desktop = new DefaultUIDesktop();
return desktop;
}

@Override
public String getName()
{
return "Shell";
}
}
5 changes: 5 additions & 0 deletions ui/api/src/main/java/org/jboss/forge/addon/ui/UIProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
*/
public interface UIProvider
{
/**
* Returns a human-friendly name of this {@link UIProvider}
*/
String getName();

/**
* Returns true if this {@link UIProvider} is running a Graphical User Interface.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ public CommandNameUIProvider(UIProvider delegate)
this.delegate = delegate;
}

@Override
public String getName()
{
return delegate.getName();
}

@Override
public boolean isGUI()
{
Expand All @@ -262,7 +268,7 @@ public UIOutput getOutput()
{
return delegate.getOutput();
}

@Override
public UIDesktop getDesktop()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ public UIProviderImpl(boolean graphical)
this.output = new UIOutputImpl(System.out, System.err);
}

@Override
public String getName()
{
return "Test Provider";
}

@Override
public boolean isGUI()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ public MockUIProvider(boolean graphical)
this.output = new UIOutputImpl(System.out, System.err);
}

@Override
public String getName()
{
return "Mock";
}

@Override
public boolean isGUI()
{
Expand Down

0 comments on commit f246915

Please sign in to comment.