org.eclipse.ui.internal.ide.DialogUtil Java Examples
The following examples show how to use
org.eclipse.ui.internal.ide.DialogUtil.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImportTraceWizardPage.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * 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); }
Example #2
Source File: OpenFileAction.java From gama with GNU General Public License v3.0 | 6 votes |
/** * 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); } }
Example #3
Source File: WizardExportResourcesPage2.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * 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); }
Example #4
Source File: WizardExportResourcesPage2.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 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); }
Example #5
Source File: NewFileWizard.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
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; }
Example #6
Source File: NewTemplateFileWizard.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
@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; }
Example #7
Source File: OpenFileWithValidAction.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
/** * 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); } }
Example #8
Source File: OpenFileWithValidAction.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
/** * 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); } }