org.eclipse.jdt.internal.ui.actions.ActionMessages Java Examples

The following examples show how to use org.eclipse.jdt.internal.ui.actions.ActionMessages. 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: RefactorActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void addRefactorSubmenu(IMenuManager menu) {
	MenuManager refactorSubmenu= new MenuManager(ActionMessages.RefactorMenu_label, MENU_ID);
	refactorSubmenu.setActionDefinitionId(QUICK_MENU_ID);
	if (fEditor != null) {
		final ITypeRoot element= getEditorInput();
		if (element != null && ActionUtil.isOnBuildPath(element)) {
			refactorSubmenu.addMenuListener(new IMenuListener() {
				public void menuAboutToShow(IMenuManager manager) {
					refactorMenuShown(manager);
				}
			});
			refactorSubmenu.add(fNoActionAvailable);
			menu.appendToGroup(fGroupName, refactorSubmenu);
		}
	} else {
		ISelection selection= fSelectionProvider.getSelection();
		for (Iterator<SelectionDispatchAction> iter= fActions.iterator(); iter.hasNext(); ) {
			iter.next().update(selection);
		}
		if (fillRefactorMenu(refactorSubmenu) > 0)
			menu.appendToGroup(fGroupName, refactorSubmenu);
	}
}
 
Example #2
Source File: ExternalizeWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public static void open(final ICompilationUnit unit, final Shell shell) {
	if (unit == null || !unit.exists()) {
		return;
	}
	Display display= shell != null ? shell.getDisplay() : Display.getCurrent();
	BusyIndicator.showWhile(display, new Runnable() {
		public void run() {
			NLSRefactoring refactoring= null;
			try {
				refactoring= NLSRefactoring.create(unit);
			} catch (IllegalArgumentException e) {
				// Loading a properties file can throw an IAE due to malformed Unicode escape sequence, see Properties#load for details.
				IStatus status= new Status(IStatus.ERROR, JavaPlugin.getPluginId(), e.getLocalizedMessage());
				ExceptionHandler.handle(status,
						NLSUIMessages.ExternalizeWizard_name,
						NLSUIMessages.ExternalizeWizard_error_message);
			}
			if (refactoring != null)
				new RefactoringStarter().activate(new ExternalizeWizard(refactoring), shell, ActionMessages.ExternalizeStringsAction_dialog_title, RefactoringSaveHelper.SAVE_REFACTORING);
		}
	});
}
 
Example #3
Source File: BuildActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private BuildActionGroup(IWorkbenchSite site, ISelectionProvider specialSelectionProvider, RefreshAction refreshAction) {
	fSelectionProvider= specialSelectionProvider != null ? specialSelectionProvider : site.getSelectionProvider();

	fBuildAction= new BuildAction(new ShellProviderAdapter(site.getShell()), IncrementalProjectBuilder.INCREMENTAL_BUILD);
	fBuildAction.setText(ActionMessages.BuildAction_label);
	fBuildAction.setActionDefinitionId(IWorkbenchCommandConstants.PROJECT_BUILD_PROJECT);

	fRefreshAction= refreshAction;
	fRefreshAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_REFRESH);

	if (specialSelectionProvider != null) {
		fRefreshAction.setSpecialSelectionProvider(specialSelectionProvider);
	}

	fSelectionProvider.addSelectionChangedListener(fBuildAction);
	fSelectionProvider.addSelectionChangedListener(fRefreshAction);
}
 
Example #4
Source File: AddJavaDocStubAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run(ITextSelection selection) {
	try {
		IJavaElement element= SelectionConverter.getElementAtOffset(fEditor);
		if (!ActionUtil.isEditable(fEditor, getShell(), element))
			return;
		int type= element != null ? element.getElementType() : -1;
		if (type != IJavaElement.METHOD && type != IJavaElement.TYPE && type != IJavaElement.FIELD) {
	 		element= SelectionConverter.getTypeAtOffset(fEditor);
	 		if (element == null) {
				MessageDialog.openInformation(getShell(), getDialogTitle(),
					ActionMessages.AddJavaDocStubsAction_not_applicable);
				return;
	 		}
		}
		IMember[] members= new IMember[] { (IMember)element };
		if (ElementValidator.checkValidateEdit(members, getShell(), getDialogTitle()))
			run(members);
	} catch (CoreException e) {
		ExceptionHandler.handle(e, getShell(), getDialogTitle(), ActionMessages.AddJavaDocStubsAction_error_actionFailed);
	}
}
 
Example #5
Source File: AddJavaDocStubAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run(IStructuredSelection selection) {
	IMember[] members= getSelectedMembers(selection);
	if (members == null || members.length == 0) {
		return;
	}

	try {
		ICompilationUnit cu= members[0].getCompilationUnit();
		if (!ActionUtil.isEditable(getShell(), cu)) {
			return;
		}

		// open the editor, forces the creation of a working copy
		IEditorPart editor= JavaUI.openInEditor(cu);

		if (ElementValidator.check(members, getShell(), getDialogTitle(), false))
			run(members);
		JavaModelUtil.reconcile(cu);
		EditorUtility.revealInEditor(editor, members[0]);

	} catch (CoreException e) {
		ExceptionHandler.handle(e, getShell(), getDialogTitle(), ActionMessages.AddJavaDocStubsAction_error_actionFailed);
	}
}
 
Example #6
Source File: GWTOpenEditorActionGroup.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
private void addOpenWithMenu(IMenuManager menu) {
  ISelection selection = getContext().getSelection();
  if (selection.isEmpty() || !(selection instanceof IStructuredSelection)) {
    return;
  }
  IStructuredSelection ss = (IStructuredSelection) selection;
  if (ss.size() != 1) {
    return;
  }

  Object o = ss.getFirstElement();
  IFile file = AdapterUtilities.getAdapter(o, IFile.class);
  if (file == null) {
    return;
  }
  
  // Create a menu.
  IMenuManager submenu = new MenuManager(ActionMessages.OpenWithMenu_label);
  submenu.add(new OpenWithMenu(site.getPage(), file));

  // Add the submenu.
  menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu);
}
 
Example #7
Source File: OpenEditorActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void addOpenWithMenu(IMenuManager menu) {
	ISelection selection= getContext().getSelection();
	if (selection.isEmpty() || !(selection instanceof IStructuredSelection))
		return;
	IStructuredSelection ss= (IStructuredSelection)selection;
	if (ss.size() != 1)
		return;

	Object o= ss.getFirstElement();
	if (!(o instanceof IAdaptable))
		return;

	IAdaptable element= (IAdaptable)o;
	Object resource= element.getAdapter(IResource.class);
	if (!(resource instanceof IFile))
		return;

	// Create a menu.
	IMenuManager submenu= new MenuManager(ActionMessages.OpenWithMenu_label);
	submenu.add(new OpenWithMenu(fSite.getPage(), (IFile) resource));

	// Add the submenu.
	menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu);
}
 
Example #8
Source File: AddUnimplementedConstructorsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createLinkControl(Composite composite) {
	Link link= new Link(composite, SWT.WRAP);
	link.setText(ActionMessages.AddUnimplementedConstructorsAction_template_link_message);
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			openCodeTempatePage(CodeTemplateContextType.CONSTRUCTORCOMMENT_ID);
		}
	});
	link.setToolTipText(ActionMessages.AddUnimplementedConstructorsAction_template_link_tooltip);

	GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
	gridData.widthHint= convertWidthInCharsToPixels(40); // only expand further if anyone else requires it
	link.setLayoutData(gridData);
	return link;
}
 
Example #9
Source File: AddGetterSetterAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createLinkControl(Composite composite) {
	Link link= new Link(composite, SWT.WRAP);
	link.setText(ActionMessages.AddGetterSetterAction_template_link_description);
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			openCodeTempatePage(CodeTemplateContextType.GETTERCOMMENT_ID);
		}
	});
	link.setToolTipText(ActionMessages.AddGetterSetterAction_template_link_tooltip);

	GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
	gridData.widthHint= convertWidthInCharsToPixels(40); // only expand further if anyone else requires it
	link.setLayoutData(gridData);
	return link;
}
 
Example #10
Source File: OpenJavaPerspectiveAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run() {
	IWorkbench workbench= JavaPlugin.getDefault().getWorkbench();
	IWorkbenchWindow window= workbench.getActiveWorkbenchWindow();
	IWorkbenchPage page= window.getActivePage();
	IAdaptable input;
	if (page != null)
		input= page.getInput();
	else
		input= ResourcesPlugin.getWorkspace().getRoot();
	try {
		workbench.showPerspective(JavaUI.ID_PERSPECTIVE, window, input);
	} catch (WorkbenchException e) {
		ExceptionHandler.handle(e, window.getShell(),
			ActionMessages.OpenJavaPerspectiveAction_dialog_title,
			ActionMessages.OpenJavaPerspectiveAction_error_open_failed);
	}
}
 
Example #11
Source File: GenerateHashCodeEqualsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
RefactoringStatus checkMember(Object memberBinding) {
	RefactoringStatus status= new RefactoringStatus();
	IVariableBinding variableBinding= (IVariableBinding)memberBinding;
	ITypeBinding fieldsType= variableBinding.getType();
	if (fieldsType.isArray())
		fieldsType= fieldsType.getElementType();
	if (!fieldsType.isPrimitive() && !fieldsType.isEnum() && !alreadyCheckedMemberTypes.contains(fieldsType) && !fieldsType.equals(fTypeBinding)) {
		status.merge(checkHashCodeEqualsExists(fieldsType, false));
		alreadyCheckedMemberTypes.add(fieldsType);
	}
	if (Modifier.isTransient(variableBinding.getModifiers()))
		status.addWarning(Messages.format(ActionMessages.GenerateHashCodeEqualsAction_transient_field_included_error, BasicElementLabels.getJavaElementName(variableBinding.getName())),
				createRefactoringStatusContext(variableBinding.getJavaElement()));
	return status;
}
 
Example #12
Source File: OverrideMethodsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run(IStructuredSelection selection) {
	try {
		final IType type= getSelectedType(selection);
		if (type == null) {
			MessageDialog.openInformation(getShell(), getDialogTitle(), ActionMessages.OverrideMethodsAction_not_applicable);
			notifyResult(false);
			return;
		}
		if (!ElementValidator.check(type, getShell(), getDialogTitle(), false) || !ActionUtil.isEditable(getShell(), type)) {
			notifyResult(false);
			return;
		}
		run(getShell(), type);
	} catch (CoreException exception) {
		ExceptionHandler.handle(exception, getShell(), getDialogTitle(), ActionMessages.OverrideMethodsAction_error_actionfailed);
	}
}
 
Example #13
Source File: OpenJavaBrowsingPerspectiveAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run() {
	IWorkbench workbench= JavaPlugin.getDefault().getWorkbench();
	IWorkbenchWindow window= workbench.getActiveWorkbenchWindow();
	IWorkbenchPage page= window.getActivePage();
	IAdaptable input;
	if (page != null)
		input= page.getInput();
	else
		input= ResourcesPlugin.getWorkspace().getRoot();
	try {
		workbench.showPerspective(JavaUI.ID_BROWSING_PERSPECTIVE, window, input);
	} catch (WorkbenchException e) {
		ExceptionHandler.handle(e, window.getShell(),
			ActionMessages.OpenJavaBrowsingPerspectiveAction_dialog_title,
			ActionMessages.OpenJavaBrowsingPerspectiveAction_error_open_failed);
	}
}
 
Example #14
Source File: SortMembersAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run(ITextSelection selection) {
	Shell shell= getShell();
	IJavaElement input= SelectionConverter.getInput(fEditor);
	if (input instanceof ICompilationUnit) {
		if (!ActionUtil.isEditable(fEditor)) {
			return;
		}
		SortMembersMessageDialog dialog= new SortMembersMessageDialog(getShell());
		if (dialog.open() != Window.OK) {
			return;
		}
		if (!ElementValidator.check(input, getShell(), getDialogTitle(), true)) {
			return;
		}
		run(shell, (ICompilationUnit) input, fEditor, dialog.isNotSortingFieldsEnabled());
	} else {
		MessageDialog.openInformation(shell, getDialogTitle(), ActionMessages.SortMembersAction_not_applicable);
	}
}
 
Example #15
Source File: OrganizeImportsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private String getOrganizeInfo(OrganizeImportsOperation op) {
	int nImportsAdded= op.getNumberOfImportsAdded();
	if (nImportsAdded >= 0) {
		if (nImportsAdded == 1) {
			return ActionMessages.OrganizeImportsAction_summary_added_singular;
		} else {
			return Messages.format(ActionMessages.OrganizeImportsAction_summary_added_plural, String.valueOf(nImportsAdded));
		}
	} else {
		if (nImportsAdded == -1) {
			return ActionMessages.OrganizeImportsAction_summary_removed_singular;
		} else {
			return Messages.format(ActionMessages.OrganizeImportsAction_summary_removed_plural, String.valueOf(-nImportsAdded));
		}
	}
}
 
Example #16
Source File: FindStringsToExternalizeAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private NonNLSElement[] doRun(IStructuredSelection selection, IProgressMonitor pm) throws CoreException {
	List<?> elements= getSelectedElementList(selection);
	if (elements == null || elements.isEmpty())
		return new NonNLSElement[0];

	pm.beginTask(ActionMessages.FindStringsToExternalizeAction_find_strings, elements.size());

	try{
		List<NonNLSElement> l= new ArrayList<NonNLSElement>();
		for (Iterator<?> iter= elements.iterator(); iter.hasNext();) {
			IJavaElement element= (IJavaElement) iter.next();
			if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT)
				l.addAll(analyze((IPackageFragment) element, new SubProgressMonitor(pm, 1)));
			else if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT)
				l.addAll(analyze((IPackageFragmentRoot) element, new SubProgressMonitor(pm, 1)));
			if (element.getElementType() == IJavaElement.JAVA_PROJECT)
				l.addAll(analyze((IJavaProject) element, new SubProgressMonitor(pm, 1)));
		}
		return l.toArray(new NonNLSElement[l.size()]);
	} finally{
		pm.done();
	}
}
 
Example #17
Source File: OpenSuperImplementationAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public void run(IMethod method) {
	if (method == null)
		return;
	if (!ActionUtil.isProcessable(getShell(), method))
		return;

	if (!checkMethod(method)) {
		MessageDialog.openInformation(getShell(), getDialogTitle(),
			Messages.format(ActionMessages.OpenSuperImplementationAction_no_super_implementation, BasicElementLabels.getJavaElementName(method.getElementName())));
		return;
	}

	try {
		IMethod impl= findSuperImplementation(method);
		if (impl != null) {
			JavaUI.openInEditor(impl, true, true);
		}
	} catch (CoreException e) {
		ExceptionHandler.handle(e, getDialogTitle(), ActionMessages.OpenSuperImplementationAction_error_message);
	}
}
 
Example #18
Source File: ClasspathContainerPreferencePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected IWizard createWizard() {
	try {
		IJavaProject project= fJavaProject;
		IClasspathEntry[] entries= project.getRawClasspath();
		return new ClasspathContainerWizard(fEntry, project, entries);
	} catch (JavaModelException e) {
		String title= ActionMessages.ConfigureContainerAction_error_title;
		String message= ActionMessages.ConfigureContainerAction_error_creationfailed_message;
		ExceptionHandler.handle(e, getShell(), title, message);
	}

	return null;
}
 
Example #19
Source File: ShowInNavigatorViewAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void run(IResource resource) {
	if (resource == null)
		return;
	try {
		IWorkbenchPage page= getSite().getWorkbenchWindow().getActivePage();
		IViewPart view= page.showView(JavaPlugin.ID_RES_NAV);
		if (view instanceof ISetSelectionTarget) {
			ISelection selection= new StructuredSelection(resource);
			((ISetSelectionTarget)view).selectReveal(selection);
		}
	} catch(PartInitException e) {
		ExceptionHandler.handle(e, getShell(), getDialogTitle(), ActionMessages.ShowInNavigatorView_error_activation_failed);
	}
}
 
Example #20
Source File: AddUnimplementedConstructorsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public IStatus validate(Object[] selection) {
	int count= countSelectedMethods(selection);
	if (count == 0)
		return new StatusInfo(IStatus.ERROR, ""); //$NON-NLS-1$
	String message= Messages.format(ActionMessages.AddUnimplementedConstructorsAction_methods_selected, new Object[] { String.valueOf(count), String.valueOf(fEntries)});
	return new StatusInfo(IStatus.INFO, message);
}
 
Example #21
Source File: GenerateMethodAbstractAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
void checkAndRun(IType type) throws CoreException {
	if (type == null) {
		MessageDialog.openInformation(getShell(), getErrorCaption(),
				ActionMessages.GenerateMethodAbstractAction_error_not_applicable);
		notifyResult(false);
	}
	if (!ElementValidator.check(type, getShell(), getErrorCaption(), false)
			|| ! ActionUtil.isEditable(fEditor, getShell(), type)) {
		notifyResult(false);
		return;
	}
	if (type == null) {
		MessageDialog.openError(getShell(), getErrorCaption(), ActionMessages.GenerateMethodAbstractAction_error_removed_type);
		notifyResult(false);
		return;
	}
	if (type.isAnnotation()) {
		MessageDialog.openInformation(getShell(), getErrorCaption(), ActionMessages.GenerateMethodAbstractAction_annotation_not_applicable);
		notifyResult(false);
		return;
	}
	if (type.isInterface()) {
		MessageDialog.openInformation(getShell(), getErrorCaption(), ActionMessages.GenerateMethodAbstractAction_interface_not_applicable);
		notifyResult(false);
		return;
	}
	if (type.isEnum()) {
		MessageDialog.openInformation(getShell(), getErrorCaption(), ActionMessages.GenerateMethodAbstractAction_enum_not_applicable);
		notifyResult(false);
		return;
	}
	if (type.isAnonymous()) {
		MessageDialog.openError(getShell(), getErrorCaption(), ActionMessages.GenerateMethodAbstractAction_anonymous_type_not_applicable);
		notifyResult(false);
		return;
	}
	run(getShell(), type);
}
 
Example #22
Source File: GenerateBuildPathActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public UpdateJarFileAction() {
	setText(ActionMessages.GenerateBuildPathActionGroup_update_jar_text);
	setDescription(ActionMessages.GenerateBuildPathActionGroup_update_jar_description);
	setToolTipText(ActionMessages.GenerateBuildPathActionGroup_update_jar_tooltip);
	setImageDescriptor(JavaPluginImages.DESC_OBJS_JAR);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.JARIMPORT_WIZARD_PAGE);
}
 
Example #23
Source File: OpenNewInterfaceWizardAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates an instance of the <code>OpenNewInterfaceWizardAction</code>.
 */
public OpenNewInterfaceWizardAction() {
	setText(ActionMessages.OpenNewInterfaceWizardAction_text);
	setDescription(ActionMessages.OpenNewInterfaceWizardAction_description);
	setToolTipText(ActionMessages.OpenNewInterfaceWizardAction_tooltip);
	setImageDescriptor(JavaPluginImages.DESC_WIZBAN_NEWINT);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.OPEN_INTERFACE_WIZARD_ACTION);

	fPage= null;
	fOpenEditorOnFinish= true;
}
 
Example #24
Source File: RefreshAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void run(final IStructuredSelection selection) {
	IWorkspaceRunnable operation= new IWorkspaceRunnable() {
		public void run(IProgressMonitor monitor) throws CoreException {
			performRefresh(selection, monitor);
		}
	};
	new WorkbenchRunnableAdapter(operation).runAsUserJob(ActionMessages.RefreshAction_refresh_operation_label, null);
}
 
Example #25
Source File: OpenNewPackageWizardAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates an instance of the <code>OpenNewPackageWizardAction</code>.
 */
public OpenNewPackageWizardAction() {
	setText(ActionMessages.OpenNewPackageWizardAction_text);
	setDescription(ActionMessages.OpenNewPackageWizardAction_description);
	setToolTipText(ActionMessages.OpenNewPackageWizardAction_tooltip);
	setImageDescriptor(JavaPluginImages.DESC_WIZBAN_NEWPACK);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.OPEN_PACKAGE_WIZARD_ACTION);
}
 
Example #26
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 #27
Source File: GenerateActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager menu) {
	super.fillContextMenu(menu);
	MenuManager subMenu= new MenuManager(ActionMessages.SourceMenu_label, MENU_ID);
	subMenu.setActionDefinitionId(QUICK_MENU_ID);
	int added= 0;
	if (isEditorOwner()) {
		added= fillEditorSubMenu(subMenu);
	} else {
		added= fillViewSubMenu(subMenu);
	}
	if (added > 0)
		menu.appendToGroup(fGroupName, subMenu);
}
 
Example #28
Source File: AddDelegateMethodsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean canRunOn(IField[] fields) throws JavaModelException {
	if (fields == null || fields.length == 0)
		return false;
	int count= 0;
	for (int index= 0; index < fields.length; index++) {
		if (!JdtFlags.isEnum(fields[index]) && !hasPrimitiveType(fields[index]) || isArray(fields[index]))
			count++;
	}
	if (count == 0)
		MessageDialog.openInformation(getShell(), DIALOG_TITLE, ActionMessages.AddDelegateMethodsAction_not_applicable);
	return (count > 0);
}
 
Example #29
Source File: AddGetterSetterAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean canRunOn(IField[] fields) throws JavaModelException {
	if (fields == null || fields.length == 0)
		return false;
	int count= 0;
	for (int index= 0; index < fields.length; index++) {
		if (!JdtFlags.isEnum(fields[index]))
			count++;
	}
	if (count == 0)
		MessageDialog.openInformation(getShell(), DIALOG_TITLE, ActionMessages.AddGetterSetterAction_not_applicable);
	return (count > 0);
}
 
Example #30
Source File: GenerateNewConstructorUsingFieldsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new <code>GenerateConstructorUsingFieldsAction</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 GenerateNewConstructorUsingFieldsAction(IWorkbenchSite site) {
	super(site);
	setText(ActionMessages.GenerateConstructorUsingFieldsAction_label);
	setDescription(ActionMessages.GenerateConstructorUsingFieldsAction_description);
	setToolTipText(ActionMessages.GenerateConstructorUsingFieldsAction_tooltip);

	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.CREATE_NEW_CONSTRUCTOR_ACTION);
}