org.eclipse.ui.IWorkbenchSite Java Examples

The following examples show how to use org.eclipse.ui.IWorkbenchSite. 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: ServiceUtils.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
/**
 * Returns an OSGi service from {@link ExecutionEvent}. It looks up a service in the following
 * locations (if exist) in the given order:
 *
 * {@code HandlerUtil.getActiveSite(event)}
 * {@code HandlerUtil.getActiveEditor(event).getEditorSite()}
 * {@code HandlerUtil.getActiveEditor(event).getSite()}
 * {@code HandlerUtil.getActiveWorkbenchWindow(event)}
 * {@code PlatformUI.getWorkbench()}
 */
public static <T> T getService(ExecutionEvent event, Class<T> api) {
  IWorkbenchSite activeSite = HandlerUtil.getActiveSite(event);
  if (activeSite != null) {
    return activeSite.getService(api);
  }

  IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
  if (activeEditor != null) {
    IEditorSite editorSite = activeEditor.getEditorSite();
    if (editorSite != null) {
      return editorSite.getService(api);
    }
    IWorkbenchPartSite site = activeEditor.getSite();
    if (site != null) {
      return site.getService(api);
    }
  }

  IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
  if (workbenchWindow != null) {
    return workbenchWindow.getService(api);
  }

  return PlatformUI.getWorkbench().getService(api);
}
 
Example #2
Source File: ReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new <code>ReferencesSearchGroup</code>. The group requires
 * that the selection provided by the given selection provider is of type
 * {@link IStructuredSelection}.
 *
 * @param site the site that will own the action group.
 * @param specialSelectionProvider the selection provider used instead of the
 *  sites selection provider.
 *
 * @since 3.4
 */
public ReferencesSearchGroup(IWorkbenchSite site, ISelectionProvider specialSelectionProvider) {
	fSite= site;
	fGroupId= IContextMenuConstants.GROUP_SEARCH;

	fFindReferencesAction= new FindReferencesAction(site);
	fFindReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKSPACE);

	fFindReferencesInProjectAction= new FindReferencesInProjectAction(site);
	fFindReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_PROJECT);

	fFindReferencesInHierarchyAction= new FindReferencesInHierarchyAction(site);
	fFindReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_HIERARCHY);

	fFindReferencesInWorkingSetAction= new FindReferencesInWorkingSetAction(site);
	fFindReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKING_SET);

	// register the actions as selection listeners
	ISelectionProvider provider= specialSelectionProvider == null ? fSite.getSelectionProvider() : specialSelectionProvider;
	ISelection selection= provider.getSelection();
	registerAction(fFindReferencesAction, provider, selection, specialSelectionProvider);
	registerAction(fFindReferencesInProjectAction, provider, selection, specialSelectionProvider);
	registerAction(fFindReferencesInHierarchyAction, provider, selection, specialSelectionProvider);
	registerAction(fFindReferencesInWorkingSetAction, provider, selection, specialSelectionProvider);
}
 
Example #3
Source File: ReadReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new <code>ReadReferencesSearchGroup</code>. The group requires
 * that the selection provided by the given selection provider is of type
 * {@link IStructuredSelection}.
 *
 * @param site the site that will own the action group.
 * @param specialSelectionProvider the selection provider used instead of the
 *  sites selection provider.
 *
 * @since 3.4
 */
public ReadReferencesSearchGroup(IWorkbenchSite site, ISelectionProvider specialSelectionProvider) {
	fSite= site;
	fGroupId= IContextMenuConstants.GROUP_SEARCH;

	fFindReadReferencesAction= new FindReadReferencesAction(site);
	fFindReadReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKSPACE);

	fFindReadReferencesInProjectAction= new FindReadReferencesInProjectAction(site);
	fFindReadReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_READ_ACCESS_IN_PROJECT);

	fFindReadReferencesInHierarchyAction= new FindReadReferencesInHierarchyAction(site);
	fFindReadReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_HIERARCHY);

	fFindReadReferencesInWorkingSetAction= new FindReadReferencesInWorkingSetAction(site);
	fFindReadReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKING_SET);

	// register the actions as selection listeners
	ISelectionProvider provider= specialSelectionProvider == null ? fSite.getSelectionProvider() : specialSelectionProvider;
	ISelection selection= provider.getSelection();
	registerAction(fFindReadReferencesAction, provider, selection, specialSelectionProvider);
	registerAction(fFindReadReferencesInProjectAction, provider, selection, specialSelectionProvider);
	registerAction(fFindReadReferencesInHierarchyAction, provider, selection, specialSelectionProvider);
	registerAction(fFindReadReferencesInWorkingSetAction, provider, selection, specialSelectionProvider);
}
 
Example #4
Source File: WriteReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new <code>WriteReferencesSearchGroup</code>. The group requires
 * that the selection provided by the given selection provider is of type
 * {@link IStructuredSelection}.
 *
 * @param site the site that will own the action group.
 * @param specialSelectionProvider the selection provider used instead of the
 *  sites selection provider.
 *
 * @since 3.4
 */
public WriteReferencesSearchGroup(IWorkbenchSite site, ISelectionProvider specialSelectionProvider) {
	fSite= site;
	fGroupId= IContextMenuConstants.GROUP_SEARCH;

	fFindWriteReferencesAction= new FindWriteReferencesAction(site);
	fFindWriteReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKSPACE);

	fFindWriteReferencesInProjectAction= new FindWriteReferencesInProjectAction(site);
	fFindWriteReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_PROJECT);

	fFindWriteReferencesInHierarchyAction= new FindWriteReferencesInHierarchyAction(site);
	fFindWriteReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_HIERARCHY);

	fFindWriteReferencesInWorkingSetAction= new FindWriteReferencesInWorkingSetAction(site);
	fFindWriteReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKING_SET);

	// register the actions as selection listeners
	ISelectionProvider provider= specialSelectionProvider == null ? fSite.getSelectionProvider() : specialSelectionProvider;
	ISelection selection= provider.getSelection();
	registerAction(fFindWriteReferencesAction, provider, selection, specialSelectionProvider);
	registerAction(fFindWriteReferencesInProjectAction, provider, selection, specialSelectionProvider);
	registerAction(fFindWriteReferencesInHierarchyAction, provider, selection, specialSelectionProvider);
	registerAction(fFindWriteReferencesInWorkingSetAction, provider, selection, specialSelectionProvider);
}
 
Example #5
Source File: EditFilterAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private EditFilterAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context) {
	super(site, selectionTarget, BuildpathModifierAction.EDIT_FILTERS);

	setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Edit_label);
	setImageDescriptor(JavaPluginImages.DESC_ELCL_CONFIGURE_BUILDPATH_FILTERS);
	setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Edit_tooltip);
	setDescription(NewWizardMessages.PackageExplorerActionGroup_FormText_Edit);
	setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_CONFIGURE_BUILDPATH_FILTERS);
}
 
Example #6
Source File: ToggleWordWrapHandler.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setEnabled(Object evaluationContext)
{
	Object activeSite = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_SITE_NAME);
	Object activeEditor = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_EDITOR_NAME);
	if (activeSite instanceof IWorkbenchSite && activeEditor instanceof AbstractThemeableEditor)
	{
		ICommandService commandService = (ICommandService) ((IWorkbenchSite) activeSite)
				.getService(ICommandService.class);
		Command command = commandService.getCommand(COMMAND_ID);
		State state = command.getState(RegistryToggleState.STATE_ID);
		state.setValue(((AbstractThemeableEditor) activeEditor).getWordWrapEnabled());
	}
}
 
Example #7
Source File: CreateLinkedSourceFolderAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private CreateLinkedSourceFolderAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context) {
	super(site, selectionTarget, BuildpathModifierAction.CREATE_LINK);

	setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Link_label);
	setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Link_tooltip);
	setImageDescriptor(JavaPluginImages.DESC_ELCL_ADD_LINKED_SOURCE_TO_BUILDPATH);
	setDescription(NewWizardMessages.PackageExplorerActionGroup_FormText_createLinkedFolder);
}
 
Example #8
Source File: TypeScriptSearchActionGroup.java    From typescript.java with MIT License 5 votes vote down vote up
private TypeScriptSearchActionGroup(IWorkbenchSite site) {
		fReferencesGroup= new ReferencesSearchGroup(site);
//		fReadAccessGroup= new ReadReferencesSearchGroup(site);
//		fWriteAccessGroup= new WriteReferencesSearchGroup(site);
//		fDeclarationsGroup= new DeclarationsSearchGroup(site);
////		fImplementorsGroup= new ImplementorsSearchGroup(site);
//		fOccurrencesGroup= new OccurrencesSearchGroup(site);
	}
 
Example #9
Source File: JavaSearchActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private JavaSearchActionGroup(IWorkbenchSite site) {
	fReferencesGroup= new ReferencesSearchGroup(site);
	fReadAccessGroup= new ReadReferencesSearchGroup(site);
	fWriteAccessGroup= new WriteReferencesSearchGroup(site);
	fDeclarationsGroup= new DeclarationsSearchGroup(site);
	fImplementorsGroup= new ImplementorsSearchGroup(site);
	fOccurrencesGroup= new OccurrencesSearchGroup(site);
}
 
Example #10
Source File: ReferencesSearchGroup.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * Creates a new <code>ReferencesSearchGroup</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 site
 *            the view part that owns this action group
 */
public ReferencesSearchGroup(IWorkbenchSite site) {
	fSite = site;
	fGroupId = IContextMenuConstants.GROUP_SEARCH;

	// fFindReferencesAction= new FindReferencesAction(site);
	// fFindReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKSPACE);

	fFindReferencesInProjectAction = new FindReferencesInProjectAction(site);
	fFindReferencesInProjectAction
			.setActionDefinitionId(ITypeScriptEditorActionDefinitionIds.SEARCH_REFERENCES_IN_PROJECT);

	// fFindReferencesInHierarchyAction= new
	// FindReferencesInHierarchyAction(site);
	// fFindReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_HIERARCHY);

	// fFindReferencesInWorkingSetAction= new
	// FindReferencesInWorkingSetAction(site);
	// fFindReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKING_SET);

	// register the actions as selection listeners
	ISelectionProvider provider = fSite.getSelectionProvider();
	ISelection selection = provider.getSelection();
	// registerAction(fFindReferencesAction, provider, selection);
	registerAction(fFindReferencesInProjectAction, provider, selection);
	// registerAction(fFindReferencesInHierarchyAction, provider,
	// selection);
	// registerAction(fFindReferencesInWorkingSetAction, provider,
	// selection);
}
 
Example #11
Source File: RenameAction.java    From typescript.java with MIT License 5 votes vote down vote up
/**
	 * Creates a new <code>RenameAction</code>. The action requires
	 * that the selection provided by the site's selection provider is of type <code>
	 * org.eclipse.jface.viewers.IStructuredSelection</code>.
	 *
	 * @param site the site providing context information for this action
	 */
	public RenameAction(IWorkbenchSite site) {
		super(site);
		setText(RefactoringMessages.RenameAction_text);
		fRenameJavaElement= new RenameTypeScriptElementAction(site);
		fRenameJavaElement.setText(getText());
//		fRenameResource= new RenameResourceAction(site);
//		fRenameResource.setText(getText());
//		PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.RENAME_ACTION);
	}
 
Example #12
Source File: OpenViewActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void createSiteActions(IWorkbenchSite site, ISelectionProvider specialProvider) {
	fOpenImplementation= new OpenImplementationAction(site);
	fOpenImplementation.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_IMPLEMENTATION);
	fOpenImplementation.setSpecialSelectionProvider(specialProvider);
	
	fOpenSuperImplementation= new OpenSuperImplementationAction(site);
	fOpenSuperImplementation.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_SUPER_IMPLEMENTATION);
	fOpenSuperImplementation.setSpecialSelectionProvider(specialProvider);

	fOpenAttachedJavadoc= new OpenAttachedJavadocAction(site);
	fOpenAttachedJavadoc.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_ATTACHED_JAVADOC);
	fOpenAttachedJavadoc.setSpecialSelectionProvider(specialProvider);

	fOpenTypeHierarchy= new OpenTypeHierarchyAction(site);
	fOpenTypeHierarchy.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_TYPE_HIERARCHY);
	fOpenTypeHierarchy.setSpecialSelectionProvider(specialProvider);

	fOpenCallHierarchy= new OpenCallHierarchyAction(site);
	fOpenCallHierarchy.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_CALL_HIERARCHY);
	fOpenCallHierarchy.setSpecialSelectionProvider(specialProvider);

	ISelectionProvider provider= specialProvider != null ? specialProvider : site.getSelectionProvider();

	fOpenPropertiesDialog= new PropertyDialogAction(site, provider);
	fOpenPropertiesDialog.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES);

	initialize(provider);
}
 
Example #13
Source File: CutAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public CutAction(IWorkbenchSite site) {
	super(site);
	setText(ReorgMessages.CutAction_text);
	fCopyToClipboardAction= new CopyToClipboardAction(site);

	ISharedImages workbenchImages= JavaPlugin.getDefault().getWorkbench().getSharedImages();
	setDisabledImageDescriptor(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED));
	setImageDescriptor(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT));
	setHoverImageDescriptor(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT));

	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.CUT_ACTION);
}
 
Example #14
Source File: AddGetterSetterAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new <code>AddGetterSetterAction</code>. The action requires that the
 * selection provided by the site's selection provider is of type <code>
 * org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param site the site providing context information for this action
 */
public AddGetterSetterAction(IWorkbenchSite site) {
	super(site);
	setText(ActionMessages.AddGetterSetterAction_label);
	setDescription(ActionMessages.AddGetterSetterAction_description);
	setToolTipText(ActionMessages.AddGetterSetterAction_tooltip);

	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.GETTERSETTER_ACTION);
}
 
Example #15
Source File: CCPActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new <code>CCPActionGroup</code>. The group requires that the selection provided by
 * the given selection provider is of type {@link IStructuredSelection}.
 * 
 * @param site the site that will own the action group.
 * @param specialSelectionProvider the selection provider used instead of the sites selection
 *            provider.
 * @param includeOnlyCopyActions <code>true</code> if the group only included the copy actions,
 *            <code>false</code> otherwise
 * @since 3.7
 */
private CCPActionGroup(IWorkbenchSite site, ISelectionProvider specialSelectionProvider, boolean includeOnlyCopyActions) {
	fSelectionProvider= specialSelectionProvider == null ? site.getSelectionProvider() : specialSelectionProvider;

	fCopyAction= new CopyToClipboardAction(site);
	fCopyAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);

	fCopyQualifiedNameAction= new CopyQualifiedNameAction(site);
	fCopyQualifiedNameAction.setActionDefinitionId(CopyQualifiedNameAction.ACTION_DEFINITION_ID);


	if (!includeOnlyCopyActions) {
		fPasteAction= new PasteAction(site);
		fPasteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE);
		fDeleteAction= new DeleteAction(site);
		fDeleteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);
		fCutAction= new CutAction(site);
		fCutAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_CUT);
		fActions= new SelectionDispatchAction[] { fCutAction, fCopyAction, fCopyQualifiedNameAction, fPasteAction, fDeleteAction };
	} else {
		fPasteAction= null;
		fDeleteAction= null;
		fCutAction= null;
		fActions= new SelectionDispatchAction[] { fCopyAction, fCopyQualifiedNameAction };
	}

	if (specialSelectionProvider != null) {
		for (int i= 0; i < fActions.length; i++) {
			fActions[i].setSpecialSelectionProvider(specialSelectionProvider);
		}
	}

	registerActionsAsSelectionChangeListeners();
}
 
Example #16
Source File: ReorgCopyAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public ReorgCopyAction(IWorkbenchSite site) {
	super(site);
	setText(ReorgMessages.ReorgCopyAction_3);
	setDescription(ReorgMessages.ReorgCopyAction_4);

	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.COPY_ACTION);
}
 
Example #17
Source File: IntroduceIndirectionAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new <code>IntroduceIndirectionAction</code>.
 *
 * @param site the site providing context information for this action
 */
public IntroduceIndirectionAction(IWorkbenchSite site) {
	super(site);
	setText(RefactoringMessages.IntroduceIndirectionAction_title);
	setToolTipText(RefactoringMessages.IntroduceIndirectionAction_tooltip);
	setDescription(RefactoringMessages.IntroduceIndirectionAction_description);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.INTRODUCE_INDIRECTION_ACTION);
}
 
Example #18
Source File: IntroduceFactoryAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new <code>IntroduceFactoryAction</code>. The action requires
 * that the selection provided by the site's selection provider is of type <code>
 * org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param site the site providing context information for this action
 */
public IntroduceFactoryAction(IWorkbenchSite site) {
	super(site);
	setText(RefactoringMessages.IntroduceFactoryAction_label);
	setToolTipText(RefactoringMessages.IntroduceFactoryAction_tooltipText);
	setDescription(RefactoringMessages.IntroduceFactoryAction_description);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.INTRODUCE_FACTORY_ACTION);
}
 
Example #19
Source File: ResetAllOutputFoldersAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public ResetAllOutputFoldersAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context, IJavaProject javaProject) {
super(site, selectionTarget, BuildpathModifierAction.RESET_ALL_OUTPUT_FOLDERS);

fContext= context;
fJavaProject= javaProject;

setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Reset_tooltip);
setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Reset_tooltip);
  }
 
Example #20
Source File: ExcludeFromBuildpathAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private ExcludeFromBuildpathAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context) {
	super(site, selectionTarget, BuildpathModifierAction.EXCLUDE);

	fContext= context;

	setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Exclude_label);
	setImageDescriptor(JavaPluginImages.DESC_ELCL_EXCLUDE_FROM_BUILDPATH);
	setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Exclude_tooltip);
	setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_EXCLUDE_FROM_BUILDPATH);
}
 
Example #21
Source File: FormatAllAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new <code>FormatAllAction</code>. The action requires
 * that the selection provided by the site's selection provider is of type <code>
 * org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param site the site providing context information for this action
 */
public FormatAllAction(IWorkbenchSite site) {
	super(site);
	setText(ActionMessages.FormatAllAction_label);
	setToolTipText(ActionMessages.FormatAllAction_tooltip);
	setDescription(ActionMessages.FormatAllAction_description);

	fCleanUpDelegate= new MultiFormatAction(site);
}
 
Example #22
Source File: OpenSuperImplementationAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new <code>OpenSuperImplementationAction</code>. The action requires
 * that the selection provided by the site's selection provider is of type <code>
 * org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param site the site providing context information for this action
 */
public OpenSuperImplementationAction(IWorkbenchSite site) {
	super(site);
	setText(ActionMessages.OpenSuperImplementationAction_label);
	setDescription(ActionMessages.OpenSuperImplementationAction_description);
	setToolTipText(ActionMessages.OpenSuperImplementationAction_tooltip);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.OPEN_SUPER_IMPLEMENTATION_ACTION);
}
 
Example #23
Source File: OpenTypeHierarchyAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new <code>OpenTypeHierarchyAction</code>. The action requires
 * that the selection provided by the site's selection provider is of type <code>
 * org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param site the site providing context information for this action
 */
public OpenTypeHierarchyAction(IWorkbenchSite site) {
	super(site);
	setText(ActionMessages.OpenTypeHierarchyAction_label);
	setToolTipText(ActionMessages.OpenTypeHierarchyAction_tooltip);
	setDescription(ActionMessages.OpenTypeHierarchyAction_description);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.OPEN_TYPE_HIERARCHY_ACTION);
}
 
Example #24
Source File: OccurrencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new <code>OccurrencesSearchGroup</code>. The group requires
 * that the selection provided by the given selection provider is of type
 * {@link IStructuredSelection}.
 *
 * @param site the site that will own the action group.
 * @param specialSelectionProvider the selection provider used instead of the
 *  sites selection provider.
 *
 * @since 3.4
 */
public OccurrencesSearchGroup(IWorkbenchSite site, ISelectionProvider specialSelectionProvider) {
	fSite= site;
	fGroupId= IContextMenuConstants.GROUP_SEARCH;

	fOccurrencesInFileAction= new FindOccurrencesInFileAction(site);
	fOccurrencesInFileAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_OCCURRENCES_IN_FILE);
	// Need to reset the label
	fOccurrencesInFileAction.setText(SearchMessages.Search_FindOccurrencesInFile_shortLabel);

	fExceptionOccurrencesAction= new FindExceptionOccurrencesAction(site);
	fExceptionOccurrencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_EXCEPTION_OCCURRENCES_IN_FILE);

	fFindImplementorOccurrencesAction= new FindImplementOccurrencesAction(site);
	fFindImplementorOccurrencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_IMPLEMENT_OCCURRENCES_IN_FILE);

	fBreakContinueTargetOccurrencesAction= new FindBreakContinueTargetOccurrencesAction(site);
	fBreakContinueTargetOccurrencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_BREAK_CONTINUE_TARGET_OCCURRENCES);

	fMethodExitOccurrencesAction= new FindMethodExitOccurrencesAction(site);
	fMethodExitOccurrencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_METHOD_EXIT_OCCURRENCES);


	// register the actions as selection listeners
	ISelectionProvider provider= specialSelectionProvider == null ? fSite.getSelectionProvider() : specialSelectionProvider;
	ISelection selection= provider.getSelection();
	registerAction(fOccurrencesInFileAction, provider, selection, specialSelectionProvider);
	registerAction(fExceptionOccurrencesAction, provider, selection, specialSelectionProvider);
	registerAction(fFindImplementorOccurrencesAction, provider, selection, specialSelectionProvider);
	registerAction(fBreakContinueTargetOccurrencesAction, provider, selection, specialSelectionProvider);
	registerAction(fMethodExitOccurrencesAction, provider, selection, specialSelectionProvider);
}
 
Example #25
Source File: AddFolderToBuildpathAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private AddFolderToBuildpathAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context) {
	super(site, selectionTarget, BuildpathModifierAction.ADD_SEL_SF_TO_BP);

	fContext= context;

	setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelSFToCP_label);
	setImageDescriptor(JavaPluginImages.DESC_ELCL_ADD_AS_SOURCE_FOLDER);
	setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelSFToCP_tooltip);
}
 
Example #26
Source File: OpenImplementationAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates an <code>OpenImplementationAction</code>.
 * 
 * @param site the workbench site
 */
protected OpenImplementationAction(IWorkbenchSite site) {
	super(site);
	setText(ActionMessages.OpenImplementationAction_label);
	setDescription(ActionMessages.OpenImplementationAction_description);
	setToolTipText(ActionMessages.OpenImplementationAction_tooltip);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.OPEN_IMPLEMENTATION_ACTION);
}
 
Example #27
Source File: AllCleanUpsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public AllCleanUpsAction(IWorkbenchSite site) {
	super(site);
	setToolTipText(ActionMessages.CleanUpAction_tooltip);
	setDescription(ActionMessages.CleanUpAction_description);
	installPreferenceListener();
	updateActionLabel();

	// PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.ORGANIZE_IMPORTS_ACTION);
}
 
Example #28
Source File: ShowActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void initialize(IWorkbenchSite site, boolean isJavaEditor) {
	fSite= site;
	ISelectionProvider provider= fSite.getSelectionProvider();
	ISelection selection= provider.getSelection();
	fShowInPackagesViewAction.update(selection);
	if (!isJavaEditor) {
		provider.addSelectionChangedListener(fShowInPackagesViewAction);
	}
}
 
Example #29
Source File: OpenProjectAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new <code>OpenProjectAction</code>. The action requires
 * that the selection provided by the site's selection provider is of type <code>
 * org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param site the site providing context information for this action
 */
public OpenProjectAction(IWorkbenchSite site) {
	super(site);
	fWorkbenchAction= new OpenResourceAction(site);
	setText(fWorkbenchAction.getText());
	setToolTipText(fWorkbenchAction.getToolTipText());
	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.OPEN_PROJECT_ACTION);
	setEnabled(hasClosedProjectsInWorkspace());
}
 
Example #30
Source File: SelectionParseAction.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
public IWorkbenchSite getSite() {
	return site;
}