org.eclipse.ui.part.IPageSite Java Examples

The following examples show how to use org.eclipse.ui.part.IPageSite. 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: JavaSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void init(IPageSite site) {
	super.init(site);
	IMenuManager menuManager = site.getActionBars().getMenuManager();
	menuManager.insertBefore(IContextMenuConstants.GROUP_PROPERTIES, new Separator(GROUP_FILTERING));
	fActionGroup.fillActionBars(site.getActionBars());
	menuManager.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new Action(SearchMessages.JavaSearchResultPage_preferences_label) {
		@Override
		public void run() {
			String pageId= "org.eclipse.search.preferences.SearchPreferencePage"; //$NON-NLS-1$
			String[] displayedPages= { pageId,
					"org.eclipse.ui.editors.preferencePages.Annotations", //$NON-NLS-1$
					"org.eclipse.ui.preferencePages.ColorsAndFonts" //$NON-NLS-1$
			};
			PreferencesUtil.createPreferenceDialogOn(JavaPlugin.getActiveWorkbenchShell(), pageId, displayedPages, null).open();
		}
	});
}
 
Example #2
Source File: OutlinePageBook.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
@Override
protected void initializeAndShowPage(final IPageBookViewPage page) {
  
  if (viewer != null)
    viewer.removeSelectionChangedListener(this);
  
  IPageSite site = new SubPageSite(getSite());

  if (book != null && page != null) {
    try {
      page.init(site);
    } catch (PartInitException e) {
      CasEditorPlugin.log(e);
    }
  }

  super.initializeAndShowPage(page);
  
  if (book != null) {
    if (page != null) {
      viewer = ((AnnotationOutline) page).getViewer();
      viewer.addSelectionChangedListener(this);
    }
    else {
      viewer = null;
    }
  }
}
 
Example #3
Source File: ProcessDiagramEditor.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public void init(IPageSite pageSite) {
	super.init(pageSite);
	ActionRegistry registry = getActionRegistry();
	IActionBars bars = pageSite.getActionBars();
	String id = ActionFactory.UNDO.getId();
	bars.setGlobalActionHandler(id, registry.getAction(id));
	id = ActionFactory.REDO.getId();
	bars.setGlobalActionHandler(id, registry.getAction(id));
	id = ActionFactory.DELETE.getId();
	bars.setGlobalActionHandler(id, registry.getAction(id));
	bars.updateActionBars();

	// Toolbar refresh to solve linux defect RATLC525198
	bars.getToolBarManager().markDirty();
}
 
Example #4
Source File: FindOccurrencesInFileAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new <code>FindOccurrencesInFileAction</code>. The action
 * requires that the selection provided by the site's selection provider is of type
 * <code>IStructuredSelection</code>.
 *
 * @param site the site providing context information for this action
 * @since 3.1
 */
public FindOccurrencesInFileAction(IWorkbenchSite site) {
	super(site);

	if (site instanceof IViewSite)
		fActionBars= ((IViewSite)site).getActionBars();
	else if (site instanceof IEditorSite)
		fActionBars= ((IEditorSite)site).getActionBars();
	else if (site instanceof IPageSite)
		fActionBars= ((IPageSite)site).getActionBars();

	setText(SearchMessages.Search_FindOccurrencesInFile_label);
	setToolTipText(SearchMessages.Search_FindOccurrencesInFile_tooltip);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.FIND_OCCURRENCES_IN_FILE_ACTION);
}
 
Example #5
Source File: JavaOutlinePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void updateSelectionProvider(IPageSite site) {
	ISelectionProvider provider= fOutlineViewer;
	if (fInput != null) {
		ICompilationUnit cu= (ICompilationUnit)fInput.getAncestor(IJavaElement.COMPILATION_UNIT);
		if (cu != null && !JavaModelUtil.isPrimary(cu))
			provider= new EmptySelectionProvider();
	}
	site.setSelectionProvider(provider);
}
 
Example #6
Source File: LibraryExplorerContextMenuProvider.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Handles all global actions
 */
private void handleGlobalAction( )
{
	IPageSite pageSite = page == null ? null : page.getSite( );
	IActionBars actionBars = pageSite == null ? null
			: pageSite.getActionBars( );

	if ( actionBars != null )
	{
		String copyID = ActionFactory.COPY.getId( );
		String pasteID = ActionFactory.PASTE.getId( );
		String deleteID = ActionFactory.DELETE.getId( );
		String moveID = ActionFactory.MOVE.getId( );
		String renameID = ActionFactory.RENAME.getId( );
		String refreshID = ActionFactory.REFRESH.getId( );

		actionBars.setGlobalActionHandler( copyID, copyResourceAction );
		actionBars.setGlobalActionHandler( pasteID, pasteResourceAction );
		actionBars.setGlobalActionHandler( deleteID, deleteResourceAction );
		actionBars.setGlobalActionHandler( moveID, moveResourceAction );
		actionBars.setGlobalActionHandler( renameID, renameResourceAction );
		actionBars.setGlobalActionHandler( refreshID, refreshExplorerAction );

		IMenuManager menuManager = actionBars.getMenuManager( );
		IToolBarManager toolBarManager = actionBars.getToolBarManager( );

		if ( menuManager != null )
		{
			menuManager.add( filterAction );
		}
		if ( toolBarManager != null )
		{
			toolBarManager.add( refreshExplorerAction );
		}
	}
}
 
Example #7
Source File: LibraryExplorerContextMenuProvider.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Updates the action bars for this page site.
 */
private void updateActionBars( )
{
	IPageSite site = page == null ? null : page.getSite( );
	IActionBars actionBars = site == null ? null : site.getActionBars( );

	if ( actionBars != null )
	{
		actionBars.updateActionBars( );
	}
}
 
Example #8
Source File: ModulaOutlinePage.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void init(IPageSite pageSite) {
    super.init(pageSite);
    pageSite.getPage().addPartListener(new ViewPartListener());
}
 
Example #9
Source File: AbstractContentOutlinePage.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void init(IPageSite pageSite) {
	super.init(pageSite);
	getSite().setSelectionProvider(this);
}
 
Example #10
Source File: FileSearchPage.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void init(IPageSite site) {
    super.init(site);
    IMenuManager menuManager = site.getActionBars().getMenuManager();
    menuManager.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new OpenSearchPreferencesAction());
}
 
Example #11
Source File: ContentOutlinePageWithFilter.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void init(IPageSite pageSite) {
    super.init(pageSite);
    pageSite.setSelectionProvider(this);
}
 
Example #12
Source File: DataViewPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void init( IPageSite pageSite )
{
	super.init( pageSite );
	pageSite.setSelectionProvider( this );
}
 
Example #13
Source File: ReportMultiBookPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void init( IPageSite site ) throws PartInitException
{
	this.site = site;
}
 
Example #14
Source File: ReportMultiBookPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public IPageSite getSite( )
{
	return site;
}
 
Example #15
Source File: LibraryExplorerViewPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void init( IPageSite pageSite )
{
	super.init( pageSite );
	pageSite.setSelectionProvider( this );
}
 
Example #16
Source File: JavaOutlinePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void init(IPageSite pageSite) {
	super.init(pageSite);
}
 
Example #17
Source File: OccurrencesSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void init(IPageSite pageSite) {
	super.init(pageSite);
	// wait until site is set
	setLinkingEnabled(getDialogSettings().getBoolean(DIALOGSTORE_LINKEDITORS));
}
 
Example #18
Source File: SVNHistoryPage.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
private void contributeActions() {
  toggleShowComments = new Action(Policy.bind("HistoryView.showComments"), //$NON-NLS-1$
      SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_COMMENTS)) {
    public void run() {
      showComments = isChecked();
      setViewerVisibility();
      store.setValue(ISVNUIConstants.PREF_SHOW_COMMENTS, showComments);
    }
  };
  toggleShowComments.setChecked(showComments);
  // PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleTextAction,
  // IHelpContextIds.SHOW_COMMENT_IN_HISTORY_ACTION);

  // Toggle wrap comments action
  toggleWrapCommentsAction = new Action(Policy.bind("HistoryView.wrapComments")) { //$NON-NLS-1$
    public void run() {
      wrapCommentsText = isChecked();
      setViewerVisibility();
      store.setValue(ISVNUIConstants.PREF_WRAP_COMMENTS, wrapCommentsText);
    }
  };
  toggleWrapCommentsAction.setChecked(wrapCommentsText);
  // PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleTextWrapAction,
  // IHelpContextIds.SHOW_TAGS_IN_HISTORY_ACTION);

  // Toggle path visible action
  toggleShowAffectedPathsAction = new Action(Policy.bind("HistoryView.showAffectedPaths"), //$NON-NLS-1$
      SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_AFFECTED_PATHS_FLAT_MODE)) {
    public void run() {
      showAffectedPaths = isChecked();
      setViewerVisibility();
      store.setValue(ISVNUIConstants.PREF_SHOW_PATHS, showAffectedPaths);
    }
  };
  toggleShowAffectedPathsAction.setChecked(showAffectedPaths);
  // PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleListAction,
  // IHelpContextIds.SHOW_TAGS_IN_HISTORY_ACTION);

  // Toggle stop on copy action
  toggleStopOnCopyAction = new Action(Policy.bind("HistoryView.stopOnCopy")) { //$NON-NLS-1$
    public void run() {
      refresh();
      SVNUIPlugin.getPlugin().getPreferenceStore().setValue(ISVNUIConstants.PREF_STOP_ON_COPY,
          toggleStopOnCopyAction.isChecked());
    }
  };
  toggleStopOnCopyAction.setChecked(store.getBoolean(ISVNUIConstants.PREF_STOP_ON_COPY));
  
  // Toggle include merged revisions action
  toggleIncludeMergedRevisionsAction = new Action(Policy.bind("HistoryView.includeMergedRevisions")) { //$NON-NLS-1$
    public void run() {
      store.setValue(ISVNUIConstants.PREF_INCLUDE_MERGED_REVISIONS, toggleIncludeMergedRevisionsAction.isChecked());
  	refreshTable();
  	refresh();
    }
  };
  toggleIncludeMergedRevisionsAction.setChecked(store.getBoolean(ISVNUIConstants.PREF_INCLUDE_MERGED_REVISIONS));    
  
  IHistoryPageSite parentSite = getHistoryPageSite();
  IPageSite pageSite = parentSite.getWorkbenchPageSite();
  IActionBars actionBars = pageSite.getActionBars();

  // Contribute toggle text visible to the toolbar drop-down
  IMenuManager actionBarsMenu = actionBars.getMenuManager();
  actionBarsMenu.add(getGetNextAction());
  actionBarsMenu.add(getGetAllAction());
  actionBarsMenu.add(toggleStopOnCopyAction);
  actionBarsMenu.add(toggleIncludeMergedRevisionsAction);
  actionBarsMenu.add(new Separator());
  actionBarsMenu.add(toggleWrapCommentsAction);
  actionBarsMenu.add(new Separator());
  actionBarsMenu.add(toggleShowComments);
  actionBarsMenu.add(toggleShowAffectedPathsAction);
  actionBarsMenu.add(new Separator());
  for (int i = 0; i < toggleAffectedPathsModeActions.length; i++) {
    actionBarsMenu.add(toggleAffectedPathsModeActions[i]);
  }
  actionBarsMenu.add(new Separator());
  for (int i = 0; i < toggleAffectedPathsLayoutActions.length; i++) {
    actionBarsMenu.add(toggleAffectedPathsLayoutActions[i]);
  }
  
  // Create the local tool bar
  IToolBarManager tbm = actionBars.getToolBarManager();
  // tbm.add(getRefreshAction());
  tbm.add(new Separator());
  tbm.add(getSearchAction());
  tbm.add(getClearSearchAction());
  tbm.add(new Separator());
  tbm.add(toggleShowComments);
  tbm.add(toggleShowAffectedPathsAction);
  tbm.add(new Separator());
  tbm.add(getGetNextAction());
  tbm.add(getGetAllAction());
  // tbm.add(getLinkWithEditorAction());
  tbm.update(false);
  
  actionBars.updateActionBars();  
}
 
Example #19
Source File: TypeScriptSearchResultPage.java    From typescript.java with MIT License 4 votes vote down vote up
public void init(IPageSite site) {
	super.init(site);
	IMenuManager menuManager = site.getActionBars().getMenuManager();
	menuManager.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new OpenSearchPreferencesAction());
}
 
Example #20
Source File: ReferenceSearchViewPage.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void init(IPageSite pageSite) {
	super.init(pageSite);
}
 
Example #21
Source File: JavaOutlinePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Creates a new <code>FormatViewElementAction</code>.
 * 
 * @param site the site providing context information for this action
 */
FormatElementAction(IPageSite site) {
	super(site);
}
 
Example #22
Source File: SubPageSite.java    From uima-uimaj with Apache License 2.0 2 votes vote down vote up
/**
 * Instantiates a new sub page site.
 *
 * @param site the site
 */
public SubPageSite(IPageSite site) {
  this.site = site;
}