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

下面列出了怎么用org.eclipse.ui.internal.ide.DialogUtil的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: tracecompass   文件: ImportTraceWizardPage.java
/**
 * Create the import source selection widget. (Copied from
 * WizardResourceImportPage but instead always uses the internal
 * ResourceTreeAndListGroup to keep compatibility with Kepler)
 */
@Override
protected void createFileSelectionGroup(Composite parent) {

    // Just create with a dummy root.
    fSelectionGroup = new ResourceTreeAndListGroup(parent,
            new FileSystemElement("Dummy", null, true), //$NON-NLS-1$
            getFolderProvider(), new WorkbenchLabelProvider(),
            getFileProvider(), new WorkbenchLabelProvider(), SWT.NONE,
            DialogUtil.inRegularFontMode(parent));

    ICheckStateListener listener = event -> updateWidgetEnablements();

    WorkbenchViewerComparator comparator = new WorkbenchViewerComparator();
    fSelectionGroup.setTreeComparator(comparator);
    fSelectionGroup.setListComparator(comparator);
    fSelectionGroup.addCheckStateListener(listener);

}
 
源代码2 项目: gama   文件: OpenFileAction.java
/**
 * Opens an editor on the given file resource.
 *
 * @param file
 *            the file resource
 */
void privateOpenFile(final IFile file) {
	try {
		final boolean activate = OpenStrategy.activateOnOpen();
		if (editorDescriptor == null) {
			IDE.openEditor(WorkbenchHelper.getPage(), file, activate);
		} else {
			if (ensureFileLocal(file)) {
				WorkbenchHelper.getPage().openEditor(new FileEditorInput(file), editorDescriptor.getId(), activate);
			}
		}
	} catch (final PartInitException e) {
		DialogUtil.openError(WorkbenchHelper.getPage().getWorkbenchWindow().getShell(),
				IDEWorkbenchMessages.OpenFileAction_openFileShellTitle, e.getMessage(), e);
	}
}
 
/**
 * 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);
}
 
源代码4 项目: 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);
}
 
源代码5 项目: 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;
}
 
源代码6 项目: 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;
}
 
/**
 * 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);
	}
}
 
源代码8 项目: 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);
	}
}
 
 类所在包
 同包方法