Skip to content

Commit

Permalink
Q452882 OpenObject action is active, even if XPCollection is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
apobekiaris committed Dec 30, 2012
1 parent 5d4c698 commit a3d5888
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,26 @@ void openObjectImplementation_ObjectToOpenChanged(Object sender, ObjectToOpenCha
}

protected override void UpdateActionState(Object objectToOpen) {
if (View is ListView)
if (ShouldUseCustomImplementation(View as ListView))
_openObjectImplementation.UpdateOpenObjectActionState(objectToOpen);
else
base.UpdateActionState(objectToOpen);
}

protected override void OnActivated() {
var listView = View as ListView;
if (listView != null) {
if (listView.Editor is GridView.GridListEditorBase) {
_openObjectImplementation = new OpenObjectFromListView(this);
_openObjectImplementation.ObjectToOpenChanged += openObjectImplementation_ObjectToOpenChanged;
_openObjectImplementation.OnControllerActivated();
}
if (ShouldUseCustomImplementation(View as ListView)) {
_openObjectImplementation = new OpenObjectFromListView(this);
_openObjectImplementation.ObjectToOpenChanged += openObjectImplementation_ObjectToOpenChanged;
_openObjectImplementation.OnControllerActivated();
} else {
base.OnActivated();
}
}

bool ShouldUseCustomImplementation(ListView listView) {
return listView != null && listView.Editor is GridView.GridListEditorBase;
}

protected override void OnDeactivated() {
var listView = View as ListView;
if (listView != null) {
Expand Down

0 comments on commit a3d5888

Please sign in to comment.