Java 类org.eclipse.ui.internal.ide.DialogUtil 实例源码

项目:translationstudio8    文件:WizardExportResourcesPage2.java   
/**
 * Creates the checkbox tree and list for selecting resources.
 * @param parent
 *            the parent control
 */
protected final void createResourcesGroup(Composite parent) {

    // create the input element, which has the root resource
    // as its only child
    List input = new ArrayList();
    IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
    for (int i = 0; i < projects.length; i++) {
        if (projects[i].isOpen()) {
            input.add(projects[i]);
        }
    }

    this.resourceGroup = new ResourceTreeAndListGroup(parent, input, getResourceProvider(IResource.FOLDER
            | IResource.PROJECT), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(),
            getResourceProvider(IResource.FILE), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(),
            SWT.NONE, DialogUtil.inRegularFontMode(parent));

    ICheckStateListener listener = new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent event) {
            updateWidgetEnablements();
        }
    };

    this.resourceGroup.addCheckStateListener(listener);
}
项目:tmxeditor8    文件:WizardExportResourcesPage2.java   
/**
 * Creates the checkbox tree and list for selecting resources.
 * @param parent
 *            the parent control
 */
protected final void createResourcesGroup(Composite parent) {

    // create the input element, which has the root resource
    // as its only child
    List input = new ArrayList();
    IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
    for (int i = 0; i < projects.length; i++) {
        if (projects[i].isOpen()) {
            input.add(projects[i]);
        }
    }

    this.resourceGroup = new ResourceTreeAndListGroup(parent, input, getResourceProvider(IResource.FOLDER
            | IResource.PROJECT), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(),
            getResourceProvider(IResource.FILE), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(),
            SWT.NONE, DialogUtil.inRegularFontMode(parent));

    ICheckStateListener listener = new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent event) {
            updateWidgetEnablements();
        }
    };

    this.resourceGroup.addCheckStateListener(listener);
}
项目:APICloud-Studio    文件:NewFileWizard.java   
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;
}
项目:APICloud-Studio    文件:NewTemplateFileWizard.java   
@Override
public boolean performFinish()
{
    IFile file = mainPage.createNewFile();
    if (file == null)
    {
        return false;
    }

    selectAndReveal(file);

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

    return true;
}
项目:translationstudio8    文件:OpenFileWithValidAction.java   
/**
 * Opens an editor on the given file resource.
 * @param file
 *            the file resource
 */
void openFile1(IFile file) throws Exception{
    try {
        boolean activate = OpenStrategy.activateOnOpen();
        if (editorDescriptor == null) {
            // 如果是nattble打开的,就验证其是否已经被打开
            if (!validIsopened(file)) {
                return;
            }
            String filePath = file.getFullPath().toOSString();
            // Bug #2519
            if (CommonFunction.validXlfExtensionByFileName(file.getName())
                    || (filePath.startsWith(File.separator + file.getProject().getName() + File.separator
                            + "Intermediate" + File.separator + "Report") && file.getName().endsWith(".html"))) {
                // 之前的这块验证 xliff 文件的代码是放在 nattable 打开时,现在改为在调用 nattable 打开之前
                // html 是不会验证路径的
                if (!file.getFullPath().getFileExtension().equals("html")) {
                    if (XLFValidator.validateXliffFile(file)) {
                        IDE.openEditor(page, file, activate);
                    }
                }else {
                    IDE.openEditor(page, file, activate);
                }
            } else {
                boolean openReult = Program.launch(file.getLocation().toOSString());
                if (!openReult) {
                    MessageDialog.openWarning(page.getWorkbenchWindow().getShell(), WorkbenchNavigatorMessages.navigator_all_dialog_warning,
                            MessageFormat.format(WorkbenchNavigatorMessages.actions_OpenFileWithValidAction_notFindProgram, new Object[]{file.getLocation().getFileExtension()}));
                }
            }
        } else {
            if (ensureFileLocal(file)) {
                if (!file.getFullPath().getFileExtension().equals("html")) {
                    if (XLFValidator.validateXliffFile(file)) {
                        page.openEditor(new FileEditorInput(file), editorDescriptor.getId(), activate);
                    }
                }else {
                    page.openEditor(new FileEditorInput(file), editorDescriptor.getId(), activate);
                }
            }
        }
    } catch (PartInitException e) {
        DialogUtil.openError(page.getWorkbenchWindow().getShell(),
                IDEWorkbenchMessages.OpenFileAction_openFileShellTitle, e.getMessage(), e);
    }
}
项目:tmxeditor8    文件:OpenFileWithValidAction.java   
/**
 * Opens an editor on the given file resource.
 * @param file
 *            the file resource
 */
void openFile1(IFile file) throws Exception{
    try {
        boolean activate = OpenStrategy.activateOnOpen();
        if (editorDescriptor == null) {
            // 如果是nattble打开的,就验证其是否已经被打开
            if (!validIsopened(file)) {
                return;
            }
            String filePath = file.getFullPath().toOSString();
            // Bug #2519
            if (CommonFunction.validXlfExtensionByFileName(file.getName())
                    || (filePath.startsWith(File.separator + file.getProject().getName() + File.separator
                            + "Intermediate" + File.separator + "Report") && file.getName().endsWith(".html"))) {
                // 之前的这块验证 xliff 文件的代码是放在 nattable 打开时,现在改为在调用 nattable 打开之前
                // html 是不会验证路径的
                if (!file.getFullPath().getFileExtension().equals("html")) {
                    if (XLFValidator.validateXliffFile(file)) {
                        IDE.openEditor(page, file, activate);
                    }
                }else {
                    IDE.openEditor(page, file, activate);
                }
            } else {
                boolean openReult = Program.launch(file.getLocation().toOSString());
                if (!openReult) {
                    MessageDialog.openWarning(page.getWorkbenchWindow().getShell(), WorkbenchNavigatorMessages.navigator_all_dialog_warning,
                            MessageFormat.format(WorkbenchNavigatorMessages.actions_OpenFileWithValidAction_notFindProgram, new Object[]{file.getLocation().getFileExtension()}));
                }
            }
        } else {
            if (ensureFileLocal(file)) {
                if (!file.getFullPath().getFileExtension().equals("html")) {
                    if (XLFValidator.validateXliffFile(file)) {
                        page.openEditor(new FileEditorInput(file), editorDescriptor.getId(), activate);
                    }
                }else {
                    page.openEditor(new FileEditorInput(file), editorDescriptor.getId(), activate);
                }
            }
        }
    } catch (PartInitException e) {
        DialogUtil.openError(page.getWorkbenchWindow().getShell(),
                IDEWorkbenchMessages.OpenFileAction_openFileShellTitle, e.getMessage(), e);
    }
}