Java Code Examples for org.eclipse.ui.IViewPart#getSite()

The following examples show how to use org.eclipse.ui.IViewPart#getSite() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NewTextSearchActionGroup.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
public NewTextSearchActionGroup(IViewPart part) {
    Assert.isNotNull(part);
    IWorkbenchPartSite site = part.getSite();
    fSelectionProvider = site.getSelectionProvider();
    fPage = site.getPage();
    fOpenPropertiesDialog = new PropertyDialogAction(site, fSelectionProvider);
    fOpenAction = new OpenFileAction(fPage);
    ISelection selection = fSelectionProvider.getSelection();

    if (selection instanceof IStructuredSelection) {
        fOpenPropertiesDialog.selectionChanged((IStructuredSelection) selection);
    } else {
        fOpenPropertiesDialog.selectionChanged(selection);
    }

}
 
Example 2
Source File: NewTextSearchActionGroup.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
public NewTextSearchActionGroup(IViewPart part) {
    Assert.isNotNull(part);
    IWorkbenchPartSite site = part.getSite();
    fSelectionProvider = site.getSelectionProvider();
    fPage = site.getPage();
    fOpenPropertiesDialog = new PropertyDialogAction(site, fSelectionProvider);
    fOpenAction = new OpenFileAction(fPage);
    ISelection selection = fSelectionProvider.getSelection();

    if (selection instanceof IStructuredSelection) {
        fOpenPropertiesDialog.selectionChanged((IStructuredSelection) selection);
    } else {
        fOpenPropertiesDialog.selectionChanged(selection);
    }

}
 
Example 3
Source File: RefactorActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new <code>RefactorActionGroup</code>. The group requires
 * that the selection provided by the part's selection provider is of type <code>
 * org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param part the view part that owns this action group
 */
public RefactorActionGroup(IViewPart part) {
	this(part.getSite(), null);

	IUndoContext workspaceContext= (IUndoContext)ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class);
	fUndoRedoActionGroup= new UndoRedoActionGroup(part.getViewSite(), workspaceContext, true);

	installQuickAccessAction();
}
 
Example 4
Source File: WebAppLaunchViewActivator.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
  IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  if (window != null) {
    IWorkbenchPage page = window.getActivePage();
    if (page != null) {
      IViewPart webAppView = page.findView(WebAppLaunchView.ID);
      if (webAppView == null) {
        try {
          webAppView = page.showView(WebAppLaunchView.ID);
        } catch (PartInitException e) {
          return StatusUtilities.newErrorStatus(e, Activator.PLUGIN_ID);
        }
      }

      if (webAppView != null) {
        synchronized(boldingLock) {
          if (bolding) {
            if (webAppView.getSite() != null) {
              IWorkbenchSiteProgressService service = 
                (IWorkbenchSiteProgressService) webAppView.getSite().getAdapter(
                  IWorkbenchSiteProgressService.class);
              if (service != null) {
                service.warnOfContentChange();
              }
            }
          } else {
            page.bringToTop(webAppView);
          }
        }
      }
    }
  }
  return Status.OK_STATUS;
}
 
Example 5
Source File: WriteAttributesOperationAction.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void init ( final IViewPart view )
{
    this.site = view.getSite ();
}
 
Example 6
Source File: BuildActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public RefreshableViewRefreshAction(IViewPart part) {
	super(part.getSite());
	fPart= part;
}
 
Example 7
Source File: WriteOperationAction.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void init ( final IViewPart view )
{
    this.site = view.getSite ();
}
 
Example 8
Source File: GWTOpenEditorActionGroup.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Creates a new <code>GWTOpenEditorActionGroup</code>. The group requires
 * that the selection provided by the part's selection provider is of type
 * <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
 * 
 * @param part the view part that owns this action group
 */
public GWTOpenEditorActionGroup(IViewPart part) {
  site = part.getSite();
  openAction = new GWTOpenAction(site);
  openAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR);
  initialize(site.getSelectionProvider());
}
 
Example 9
Source File: OpenEditorActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Creates a new <code>OpenActionGroup</code>. The group requires
 * that the selection provided by the part's selection provider is of type <code>
 * org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param part the view part that owns this action group
 */
public OpenEditorActionGroup(IViewPart part) {
	this(part.getSite(), null);
}
 
Example 10
Source File: ProjectActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Creates a new <code>ProjectActionGroup</code>. The group requires
 * that the selection provided by the site's selection provider is of type <code>
 * org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param part the view part that owns this action group
 */
public ProjectActionGroup(IViewPart part) {
	this(part.getSite(), part.getSite().getSelectionProvider());
}
 
Example 11
Source File: CCPActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Creates a new <code>CCPActionGroup</code>. The group requires that the selection provided by
 * the view part's selection provider is of type
 * <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
 * 
 * @param part the view part that owns this action group
 * @param includeOnlyCopyActions <code>true</code> if the group only includes the copy actions,
 *            <code>false</code> to include all actions
 * @since 3.7
 */
public CCPActionGroup(IViewPart part, boolean includeOnlyCopyActions) {
	this(part.getSite(), null, includeOnlyCopyActions);
}
 
Example 12
Source File: CCPActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Creates a new <code>CCPActionGroup</code>. The group requires that
 * the selection provided by the view part's selection provider is of type
 * <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param part the view part that owns this action group
 */
public CCPActionGroup(IViewPart  part) {
	this(part.getSite(), null, false);
}
 
Example 13
Source File: FindOccurrencesInFileAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Creates a new <code>FindOccurrencesInFileAction</code>. The action requires
 * that the selection provided by the view part's selection provider is of type <code>
 * org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param part the part providing context information for this action
 */
public FindOccurrencesInFileAction(IViewPart part) {
	this(part.getSite());
}
 
Example 14
Source File: GenerateActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Creates a new <code>GenerateActionGroup</code>. The group
 * requires that the selection provided by the part's selection provider
 * is of type <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param part the view part that owns this action group
 */
public GenerateActionGroup(IViewPart part) {
	this(part.getSite(), null);

	installQuickAccessAction();
}
 
Example 15
Source File: ShowActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Creates a new <code>ShowActionGroup</code>. The action requires
 * that the selection provided by the part's selection provider is of type
 * <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param part the view part that owns this action group
 */
public ShowActionGroup(IViewPart part) {
	this(part.getSite());
	fIsPackageExplorer= part instanceof PackageExplorerPart;
}
 
Example 16
Source File: BuildActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Creates a new <code>BuildActionGroup</code>. The group requires that
 * the selection provided by the view part's selection provider is of type
 * <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param part the view part that owns this action group
 */
public BuildActionGroup(final IViewPart part) {
	this(part.getSite(), null, new RefreshableViewRefreshAction(part));
}
 
Example 17
Source File: OpenEditorActionGroup.java    From xds-ide with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Creates a new <code>OpenActionGroup</code>. The group requires
 * that the selection provided by the part's selection provider is of type <code>
 * org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param part the view part that owns this action group
 */
public OpenEditorActionGroup(IViewPart part) {
	this(part.getSite(), null);
}
 
Example 18
Source File: GenerateBuildPathActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
   * Creates a new <code>GenerateActionGroup</code>. The group
   * requires that the selection provided by the part's selection provider
   * is of type <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
   *
   * @param part the view part that owns this action group
   */
  public GenerateBuildPathActionGroup(IViewPart part) {
this(part.getSite(), part.getSite().getSelectionProvider());
  }
 
Example 19
Source File: N4JSProjectActionGroup.java    From n4js with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Creates a new {@code N4JSProjectActionGroup}. The group requires that the selection provided by the site's
 * selection provider is of type {@link IStructuredSelection}.
 *
 * @param part
 *            the view part that owns this action group
 */
public N4JSProjectActionGroup(final IViewPart part) {
	this(part.getSite(), part.getSite().getSelectionProvider());
}