Skip to content

Commit

Permalink
Trying to fix #15
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrygusev committed May 24, 2014
1 parent 0295969 commit 05b9475
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;

import com.anjlab.eclipse.tapestry5.Activator;
import com.anjlab.eclipse.tapestry5.EclipseUtils;
import com.anjlab.eclipse.tapestry5.TapestryContext;
import com.anjlab.eclipse.tapestry5.TapestryModule;
import com.anjlab.eclipse.tapestry5.TapestryUtils;
import com.anjlab.eclipse.tapestry5.views.context.TapestryContextView;

public class CreateActionViewDelegate implements IViewActionDelegate, IMenuCreator
{
Expand Down Expand Up @@ -91,8 +91,8 @@ public Menu getMenu(Control parent)
{
Menu menu = new Menu(parent);

TapestryContext tapestryContext = fromView
? Activator.getDefault().getTapestryContext(window)
TapestryContext tapestryContext = view instanceof TapestryContextView
? ((TapestryContextView) view).getTapestryContext()
: TapestryUtils.createTapestryContext(window); // From Main ToolBar

TapestryModule module;
Expand Down Expand Up @@ -195,20 +195,19 @@ public Menu getMenu(Menu parent)
return null;
}

private boolean fromView;
private IWorkbenchWindow window;
private IViewPart view;

@Override
public void init(IViewPart view)
{
this.view = view;
this.window = view.getSite().getWorkbenchWindow();
this.fromView = true;
}

public void init(IWorkbenchWindow window)
{
this.window = window;
this.fromView = false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ public void projectChanged(IWorkbenchWindow window, TapestryProject newTapestryP
Activator.getDefault().addTapestryContextListener(getViewSite().getWorkbenchWindow(), tapestryContextListener);
}

public TapestryContext getTapestryContext()
{
return ((TapestryContextContentProvider) viewer.getContentProvider()).getContext();
}

@Override
public void dispose()
{
Expand Down

0 comments on commit 05b9475

Please sign in to comment.