gpt4 book ai didi

org.eclipse.ui.dialogs.WizardNewFileCreationPage.createNewFile()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 15:11:05 26 4
gpt4 key购买 nike

本文整理了Java中org.eclipse.ui.dialogs.WizardNewFileCreationPage.createNewFile()方法的一些代码示例,展示了WizardNewFileCreationPage.createNewFile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WizardNewFileCreationPage.createNewFile()方法的具体详情如下:
包路径:org.eclipse.ui.dialogs.WizardNewFileCreationPage
类名称:WizardNewFileCreationPage
方法名:createNewFile

WizardNewFileCreationPage.createNewFile介绍

[英]Creates a new file resource in the selected container and with the selected name. Creates any missing resource containers along the path; does nothing if the container resources already exist.

In normal usage, this method is invoked after the user has pressed Finish on the wizard; the enablement of the Finish button implies that all controls on on this page currently contain valid values.

Note that this page caches the new file once it has been successfully created; subsequent invocations of this method will answer the same file resource without attempting to create it again.

This method should be called within a workspace modify operation since it creates resources.
[中]

代码示例

代码示例来源:origin: RepreZen/KaiZen-OpenAPI-Editor

@Override
public boolean performFinish() {
  final IFile file = page.createNewFile();
  if (file == null || !file.exists()) {
    return false;
  }
  getShell().getDisplay().asyncExec(new Runnable() {
    public void run() {
      IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
      try {
        IDE.openEditor(page, file, editorId);
      } catch (PartInitException e) {
      }
    }
  });
  return true;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

@Override
  public boolean performFinish() {
    IFile file = mainPage.createNewFile();
    if (file == null) {
      return false;
    }

    selectAndReveal(file);

    // Open editor on new file.
    IWorkbenchWindow dw = getWorkbench().getActiveWorkbenchWindow();
    try {
      if (dw != null) {
        IWorkbenchPage page = dw.getActivePage();
        if (page != null) {
          IDE.openEditor(page, file, true);
        }
      }
    } catch (PartInitException e) {
      DialogUtil.openError(dw.getShell(), ResourceMessages.FileResource_errorMessage,
          e.getMessage(), e);
    }

    return true;
  }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com