当前位置: 首页>>代码示例>>Java>>正文


Java OpenNewClassWizardAction类代码示例

本文整理汇总了Java中org.eclipse.jdt.ui.actions.OpenNewClassWizardAction的典型用法代码示例。如果您正苦于以下问题:Java OpenNewClassWizardAction类的具体用法?Java OpenNewClassWizardAction怎么用?Java OpenNewClassWizardAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OpenNewClassWizardAction类属于org.eclipse.jdt.ui.actions包,在下文中一共展示了OpenNewClassWizardAction类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import org.eclipse.jdt.ui.actions.OpenNewClassWizardAction; //导入依赖的package包/类
public void run()
{
    NewClassWizardPage wizardPage = new NewClassWizardPage();
    
    IJavaProject javaProject = JavaCore.create(project);
    
    IFolder folder = project.getFolder(getSourceFolder());
    IPackageFragmentRoot sourceFolder = javaProject.getPackageFragmentRoot(folder);
    wizardPage.setPackageFragmentRoot(sourceFolder, true);
    
    IPackageFragment pkg = sourceFolder.getPackageFragment(getPackageName());
    wizardPage.setPackageFragment(pkg, true);
    
    wizardPage.setTypeName(getTypeName() == null ? "" : getTypeName(), true);
    
    OpenNewClassWizardAction action = new OpenNewClassWizardAction();
    action.setConfiguredWizardPage(wizardPage);
    action.run();
}
 
开发者ID:anjlab,项目名称:eclipse-tapestry5-plugin,代码行数:20,代码来源:NewJavaClassWizardAction.java

示例2: createNewClass

import org.eclipse.jdt.ui.actions.OpenNewClassWizardAction; //导入依赖的package包/类
void createNewClass(final Button classButton,
        final ComboViewer methodComboViewer) {
    final OpenNewClassWizardAction action = new OpenNewClassWizardAction();
    action.setSelection(new StructuredSelection(project));
    final Page page = new Page(sourceType);
    page.init(new StructuredSelection(project));
    action.setConfiguredWizardPage(page);
    action.run();
    final IType type = (IType) action.getCreatedElement();
    if (type != null) {
        try {
            type.createMethod("public " + page.returnType + " " + page.methodName + "("
                    + page.prmType + " input) {\n"
                    + "\treturn null;\n"
                    + "}",
                    null, false, null);
            if (type.getCompilationUnit().isWorkingCopy()) {
                type.getCompilationUnit().commitWorkingCopy(true, null);
            }
            setClass(type, classButton, methodComboViewer);
        } catch (final JavaModelException e) {
            Activator.error(e);
        }
    }
}
 
开发者ID:fabric8io,项目名称:data-mapper,代码行数:26,代码来源:AddCustomFunctionDialog.java

示例3: createNewClassWizard

import org.eclipse.jdt.ui.actions.OpenNewClassWizardAction; //导入依赖的package包/类
/**
 * Creates the new class wizard.
 * 
 * @param fileNameTextBox
 *            the file name
 * @param widgetConfig 
 */
public void createNewClassWizard(Text fileNameTextBox, WidgetConfig widgetConfig) {
	OpenNewClassWizardAction wizard = new OpenNewClassWizardAction();
	wizard.setOpenEditorOnFinish(false);
	final CustomizeNewClassWizardPage page = new CustomizeNewClassWizardPage();
	page.setSuperClass("java.lang.Object", true);
	page.setMethodStubSelection(false, false, true, true);
	List<String> interfaceList = new ArrayList<String>();
	OperationClassConfig operationClassConfig = (OperationClassConfig) widgetConfig;
	Operations operations = XMLConfigUtil.INSTANCE.getComponent(getComponentName()).getOperations();
	TypeInfo typeInfo=operations.getInterface();
	if (operationClassConfig!=null && operationClassConfig.getComponentName().equalsIgnoreCase(typeInfo.getName()))
	{
		interfaceList.add(typeInfo.getClazz());
	}
	page.setSuperInterfaces(interfaceList, true);  
	wizard.setConfiguredWizardPage(page);
	if(OSValidator.isMac()){
		Display.getDefault().timerExec(0, new Runnable() {

			@Override
			public void run() {
				page.getControl().forceFocus();					
			}
		});
	}
	wizard.run();
	if (page.isPageComplete()) {
		if(!page.getPackageText().equalsIgnoreCase("")){
			fileNameTextBox.setText(page.getPackageText()+"."
					+ page.getTypeName());
		}else{
			fileNameTextBox.setText(page.getTypeName());
		}
	}
	fileNameTextBox.setData("path", "/" + page.getPackageFragmentRootText() + "/"
			+ page.getPackageText().replace(".", "/") + "/"
			+ page.getTypeName() + ".java");
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:46,代码来源:FilterOperationClassUtility.java

示例4: execute

import org.eclipse.jdt.ui.actions.OpenNewClassWizardAction; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	
	try {
		OpenNewClassWizardAction wizard = new OpenNewClassWizardAction();
		wizard.setOpenEditorOnFinish(false);
		final NewClassWizardPage page = new NewClassWizardPage();
		page.setSuperClass("java.lang.Object", true);

		List<String> interfaceList = new ArrayList<String>();

		String ClassType = event.getCommand().getId();

		if (ClassType.equalsIgnoreCase(FILTER_CLASS)) {
			interfaceList.add(Messages.INF_FILTER_BASE_CLASS);
		} else if (ClassType.equalsIgnoreCase(AGGREGATOR_CLASS)) {
			interfaceList.add(Messages.INF_AGGREGATOR_BASE_CLASS);
		} else if (ClassType.equalsIgnoreCase(TRANFORM_CLASS)) {
			interfaceList.add(Messages.INF_TRANFORM_BASE_CLASS);
		}else if (ClassType.equalsIgnoreCase(CUMULATE_CLASS)) {
			interfaceList.add(Messages.INF_CUMULATE_BASE_CLASS);
		}else if (ClassType.equalsIgnoreCase(NORMALISE_CLASS)) {
			interfaceList.add(Messages.INF_NORMALIZE_BASE_CLASS);
		}

		page.setMethodStubSelection(false, false,true, true);
		page.setSuperInterfaces(interfaceList, false);

		wizard.setConfiguredWizardPage(page);
		if (OSValidator.isMac()) {
			Display.getDefault().timerExec(0, new Runnable() {

				@Override
				public void run() {
					page.getControl().forceFocus();
				}
			});
		}
		wizard.run();
	} catch (Exception e) {
		logger.error(e.getMessage());
	}
	return null;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:45,代码来源:NewCustomClassHandler.java

示例5: run

import org.eclipse.jdt.ui.actions.OpenNewClassWizardAction; //导入依赖的package包/类
@Override
public void run() {
	new OpenNewClassWizardAction().run();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:5,代码来源:NewTypeDropDownAction.java


注:本文中的org.eclipse.jdt.ui.actions.OpenNewClassWizardAction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。