Skip to content

Commit

Permalink
use widget reference for close all (rather than 0 index)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Jun 16, 2011
1 parent ed5648b commit 6504d03
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Expand Up @@ -96,6 +96,7 @@ void addTab(Widget widget,
int getTabCount();
int getActiveTabIndex();
void closeTab(Widget widget, boolean interactive);
void closeTab(Widget widget, boolean interactive, Command onClosed);
void closeTab(int index, boolean interactive);
void closeTab(int index, boolean interactive, Command onClosed);
void setDirty(Widget widget, boolean dirty);
Expand Down Expand Up @@ -496,8 +497,10 @@ public void onCloseAllSourceDocs()
cpsExecuteForEachEditor(new CPSEditingTargetCommand()
{
@Override
public void execute(EditingTarget target, final Command continuation)
{
public void execute(final EditingTarget target, final Command continuation)
{
final Widget widget = target.toWidget();

if (target.dirtyState().getValue())
{
// save (with prompt) then close
Expand All @@ -507,14 +510,14 @@ public void execute(EditingTarget target, final Command continuation)
{
public void execute()
{
view_.closeTab(0, false, continuation);
view_.closeTab(widget, false, continuation);
}
});
}
else
{
// close without saving or prompting
view_.closeTab(0, false, continuation);
view_.closeTab(widget, false, continuation);
}

}
Expand Down
Expand Up @@ -120,9 +120,14 @@ public void addTab(Widget widget,

public void closeTab(Widget child, boolean interactive)
{
closeTab(tabPanel_.getWidgetIndex(child), interactive);
closeTab(child, interactive, null);
}

public void closeTab(Widget child, boolean interactive, Command onClosed)
{
closeTab(tabPanel_.getWidgetIndex(child), interactive, onClosed);
}

public void closeTab(int index, boolean interactive)
{
closeTab(index, interactive, null);
Expand Down

0 comments on commit 6504d03

Please sign in to comment.