Search in sources :

Example 1 with NewAnnotationCreationWizard

use of org.eclipse.jdt.internal.ui.wizards.NewAnnotationCreationWizard in project xtext-eclipse by eclipse.

the class CreateJavaTypeQuickfixes method newJavaAnnotationQuickfix.

protected void newJavaAnnotationQuickfix(final String typeName, final String explicitPackage, final XtextResource resource, Issue issue, IssueResolutionAcceptor issueResolutionAcceptor) {
    String packageDescription = getPackageDescription(explicitPackage);
    issueResolutionAcceptor.accept(issue, "Create Java annotation '@" + typeName + "'" + packageDescription, "Opens the new Java annotation wizard to create the type '@" + typeName + "'" + packageDescription, "java_file.gif", new IModification() {

        @Override
        public void apply(/* @Nullable */
        IModificationContext context) throws Exception {
            runAsyncInDisplayThread(new Runnable() {

                @Override
                public void run() {
                    NewAnnotationWizardPage annotationWizardPage = new NewAnnotationWizardPage();
                    NewAnnotationCreationWizard wizard = new NewAnnotationCreationWizard(annotationWizardPage, true);
                    WizardDialog dialog = createWizardDialog(wizard);
                    configureWizardPage(annotationWizardPage, resource.getURI(), typeName, explicitPackage);
                    dialog.open();
                }
            });
        }
    });
}
Also used : IModificationContext(org.eclipse.xtext.ui.editor.model.edit.IModificationContext) NewAnnotationWizardPage(org.eclipse.jdt.ui.wizards.NewAnnotationWizardPage) NewAnnotationCreationWizard(org.eclipse.jdt.internal.ui.wizards.NewAnnotationCreationWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog) JavaModelException(org.eclipse.jdt.core.JavaModelException) IModification(org.eclipse.xtext.ui.editor.model.edit.IModification)

Aggregations

JavaModelException (org.eclipse.jdt.core.JavaModelException)1 NewAnnotationCreationWizard (org.eclipse.jdt.internal.ui.wizards.NewAnnotationCreationWizard)1 NewAnnotationWizardPage (org.eclipse.jdt.ui.wizards.NewAnnotationWizardPage)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 IModification (org.eclipse.xtext.ui.editor.model.edit.IModification)1 IModificationContext (org.eclipse.xtext.ui.editor.model.edit.IModificationContext)1