本文整理汇总了Java中org.eclipse.jdt.ui.actions.OpenNewClassWizardAction.run方法的典型用法代码示例。如果您正苦于以下问题:Java OpenNewClassWizardAction.run方法的具体用法?Java OpenNewClassWizardAction.run怎么用?Java OpenNewClassWizardAction.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.ui.actions.OpenNewClassWizardAction
的用法示例。
在下文中一共展示了OpenNewClassWizardAction.run方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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);
}
}
}
示例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");
}
示例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;
}