org.eclipse.jdt.internal.ui.wizards.NewElementWizard Java Examples

The following examples show how to use org.eclipse.jdt.internal.ui.wizards.NewElementWizard. 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: CreateXtendTypeQuickfixes.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
protected void newXtendClassQuickfix(final String typeName, final String explicitPackage, final XtextResource resource, Issue issue,
		IssueResolutionAcceptor issueResolutionAcceptor) {
	String packageDescription = getPackageDescription(explicitPackage);
	issueResolutionAcceptor.accept(issue, "Create Xtend class '" + typeName + "'" + packageDescription,
			"Opens the new Xtend class wizard to create the type '" + typeName + "'" + packageDescription, "xtend_file.png",
			new IModification() {
				@Override
				public void apply(/* @Nullable */ IModificationContext context) throws Exception {
					runAsyncInDisplayThread(new Runnable() {
						@Override
						public void run() {
							NewElementWizard newXtendClassWizard = newXtendClassWizardProvider.get();
							WizardDialog dialog = createWizardDialog(newXtendClassWizard);
							NewXtendClassWizardPage page = (NewXtendClassWizardPage) newXtendClassWizard.getStartingPage();
							configureWizardPage(page, resource.getURI(), typeName, explicitPackage);
							dialog.open();
						}
					});
				}
			});
}
 
Example #2
Source File: CreateXtendTypeQuickfixes.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
protected void newXtendInterfaceQuickfix(final String typeName, final String explicitPackage, final XtextResource resource, Issue issue,
		IssueResolutionAcceptor issueResolutionAcceptor) {
	String packageDescription = getPackageDescription(explicitPackage);
	issueResolutionAcceptor.accept(issue, "Create Xtend interface '" + typeName + "'" + packageDescription,
			"Opens the new Xtend interface wizard to create the type '" + typeName + "'" + packageDescription, "xtend_file.png",
			new IModification() {
				@Override
				public void apply(/* @Nullable */ IModificationContext context) throws Exception {
					runAsyncInDisplayThread(new Runnable() {
						@Override
						public void run() {
							NewElementWizard newXtendInterfaceWizard = newXtendInterfaceWizardProvider.get();
							WizardDialog dialog = createWizardDialog(newXtendInterfaceWizard);
							NewXtendInterfaceWizardPage page = (NewXtendInterfaceWizardPage) newXtendInterfaceWizard.getStartingPage();
							configureWizardPage(page, resource.getURI(), typeName, explicitPackage);
							dialog.open();
						}
					});
				}
			});
}
 
Example #3
Source File: CreateXtendTypeQuickfixes.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
protected void newXtendAnnotationQuickfix(final String typeName, final String explicitPackage, final XtextResource resource, Issue issue,
		IssueResolutionAcceptor issueResolutionAcceptor) {
	String packageDescription = getPackageDescription(explicitPackage);
	issueResolutionAcceptor.accept(issue, "Create Xtend annotation '" + typeName + "'" + packageDescription,
			"Opens the new Xtend annotation wizard to create the type '" + typeName + "'" + packageDescription, "xtend_file.png",
			new IModification() {
				@Override
				public void apply(/* @Nullable */ IModificationContext context) throws Exception {
					runAsyncInDisplayThread(new Runnable() {
						@Override
						public void run() {
							NewElementWizard newXtendAnnotationWizard = newXtendAnnotationWizardProvider.get();
							WizardDialog dialog = createWizardDialog(newXtendAnnotationWizard);
							NewXtendAnnotationWizardPage page = (NewXtendAnnotationWizardPage) newXtendAnnotationWizard.getStartingPage();
							configureWizardPage(page, resource.getURI(), typeName, explicitPackage);
							dialog.open();
						}
					});
				}
			});
}
 
Example #4
Source File: AbstractOpenWizardAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run() {
	Shell shell= getShell();
	if (!doCreateProjectFirstOnEmptyWorkspace(shell)) {
		return;
	}
	try {
		INewWizard wizard= createWizard();
		wizard.init(PlatformUI.getWorkbench(), getSelection());

		WizardDialog dialog= new WizardDialog(shell, wizard);
		PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
		dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
		dialog.create();
		int res= dialog.open();
		if (res == Window.OK && wizard instanceof NewElementWizard) {
			fCreatedElement= ((NewElementWizard)wizard).getCreatedElement();
		}

		notifyResult(res == Window.OK);
	} catch (CoreException e) {
		String title= NewWizardMessages.AbstractOpenWizardAction_createerror_title;
		String message= NewWizardMessages.AbstractOpenWizardAction_createerror_message;
		ExceptionHandler.handle(e, shell, title, message);
	}
}
 
Example #5
Source File: CreateJavaTypeQuickfixes.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected WizardDialog createWizardDialog(NewElementWizard newXtendClassWizard) {
	IWorkbench workbench = PlatformUI.getWorkbench();
	Shell shell = workbench.getActiveWorkbenchWindow().getShell();
	newXtendClassWizard.init(workbench, new StructuredSelection());
	WizardDialog dialog = new WizardDialog(shell, newXtendClassWizard);
	dialog.create();
	return dialog;
}
 
Example #6
Source File: AbstractOpenWizardAction.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void run() {
  Shell localShell = getShell();
  if (!doCreateProjectFirstOnEmptyWorkspace(localShell)) {
    return;
  }

  try {
    INewWizard wizard = createWizard();
    wizard.init(PlatformUI.getWorkbench(), getSelection());

    WizardDialog dialog = new WizardDialog(localShell, wizard);
    IPixelConverter converter =
        PixelConverterFactory.createPixelConverter(JFaceResources.getDialogFont());
    dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70),
        converter.convertHeightInCharsToPixels(20));
    dialog.create();
    int res = dialog.open();
    if (res == Window.OK && wizard instanceof NewElementWizard) {
      createdElement = ((NewElementWizard) wizard).getCreatedElement();
    }

    notifyResult(res == Window.OK);
  } catch (CoreException e) {
    String title = NewWizardMessages.AbstractOpenWizardAction_createerror_title;
    String message = NewWizardMessages.AbstractOpenWizardAction_createerror_message;
    ExceptionHandler.handle(e, localShell, title, message);
  }
}
 
Example #7
Source File: CreateAsyncInterfaceProposal.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private NewElementWizard createWizard(StructuredSelection selection) {
  NewAsyncRemoteServiceInterfaceCreationWizardPage page =
      new NewAsyncRemoteServiceInterfaceCreationWizardPage(syncTypeBinding);
  page.init(selection);
  configureWizardPage(page);
  return new NewAsyncRemoteServiceInterfaceCreationWizard(page, true);
}
 
Example #8
Source File: CreateAsyncInterfaceProposal.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
private NewTypeWizardPage getPage(NewElementWizard wizard) {
  IWizardPage[] pages = wizard.getPages();
  Assert.isTrue(pages.length > 0 && pages[0] instanceof NewTypeWizardPage);
  return (NewTypeWizardPage) pages[0];
}
 
Example #9
Source File: NewCUUsingWizardProposal.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private NewTypeWizardPage getPage(NewElementWizard wizard) {
	IWizardPage[] pages= wizard.getPages();
	Assert.isTrue(pages.length > 0 && pages[0] instanceof NewTypeWizardPage);
	return (NewTypeWizardPage) pages[0];
}