private String getInitPath() { String initPath= fPathField.getText(); if (initPath.length() == 0) { initPath= fDialogSettings.get(IUIConstants.DIALOGSTORE_LASTEXTJAR); if (initPath == null) { initPath= ""; //$NON-NLS-1$ } } else { IPath entryPath= new Path(initPath); if (ArchiveFileFilter.isArchivePath(entryPath, true)) { entryPath.removeLastSegments(1); } initPath= entryPath.toOSString(); } return initPath; }
private String getInitPath() { String initPath= fPathField.getText(); if (initPath.length() == 0) { initPath= fDialogSettings.get(IUIConstants.DIALOGSTORE_LASTEXTJAR); if (initPath == null) { initPath= ""; //$NON-NLS-1$ } } else { IPath entryPath= new Path(initPath); if (ArchiveFileFilter.isArchivePath(entryPath)) { entryPath.removeLastSegments(1); } initPath= entryPath.toOSString(); } return initPath; }
private String getInitPath() { String initPath= fPathField.getText(); if (initPath.length() == 0) { initPath= fDialogSettings.get(IUIConstants.DIALOGSTORE_LASTEXTJAR); if (initPath == null) { initPath= ""; //$NON-NLS-1$ } } else { IPath entryPath= new Path(initPath); if (ArchiveFileFilter.isArchivePath(entryPath, true)) { entryPath.removeLastSegments(1); } initPath= entryPath.toOSString(); } return initPath; }
private String getPathString(IPath path, boolean isExternal) { if (ArchiveFileFilter.isArchivePath(path)) { IPath appendedPath= path.removeLastSegments(1); String appended= isExternal ? appendedPath.toOSString() : appendedPath.makeRelative().toString(); return Messages.format(NewWizardMessages.CPListLabelProvider_twopart, new String[] { path.lastSegment(), appended }); } else { return isExternal ? path.toOSString() : path.makeRelative().toString(); } }
/** * Check whether the provided file is an archive (.jar or .zip). * * @param file the file to be checked * @param project the Java project * @return <code>true</code> if the file is an archive, <code>false</code> * otherwise * @throws JavaModelException */ public static boolean isArchive(IFile file, IJavaProject project) throws JavaModelException { if (!ArchiveFileFilter.isArchivePath(file.getFullPath(), true)) return false; if (project != null && project.exists() && (project.findPackageFragmentRoot(file.getFullPath()) == null)) return true; return false; }
/** * Check whether the provided file is an archive (.jar or .zip). * * @param file the file to be checked * @param project the Java project * @return <code>true</code> if the file is an archive, <code>false</code> * otherwise * @throws JavaModelException */ public static boolean isArchive(IFile file, IJavaProject project) throws JavaModelException { if (!ArchiveFileFilter.isArchivePath(file.getFullPath())) return false; if (project != null && project.exists() && (project.findPackageFragmentRoot(file.getFullPath()) == null)) return true; return false; }
private String getPathString(IPath path, boolean isExternal) { if (ArchiveFileFilter.isArchivePath(path, true)) { String appended= BasicElementLabels.getPathLabel(path.removeLastSegments(1), isExternal); String lastSegment= BasicElementLabels.getResourceName(path.lastSegment()); return Messages.format(NewWizardMessages.CPListLabelProvider_twopart, new String[] { lastSegment, appended }); } else { return BasicElementLabels.getPathLabel(path, isExternal); } }
private String getPathString(IPath path, boolean isExternal) { if (ArchiveFileFilter.isArchivePath(path, true)) { String appended= BasicElementLabels.getPathLabel(path.removeLastSegments(1), isExternal); String lastSegment= BasicElementLabels.getResourceName(path.lastSegment()); return Messages.format(NewWizardMessages.CPListLabelProvider_twopart, new String[] { lastSegment, appended }); } else { return BasicElementLabels.getPathLabel(path, isExternal); } }
private static IFile getCandidate(IAdaptable element) throws JavaModelException { IResource resource= element.getAdapter(IResource.class); if (! (resource instanceof IFile) || ! ArchiveFileFilter.isArchivePath(resource.getFullPath(), true)) return null; IJavaProject project= JavaCore.create(resource.getProject()); if (project != null && project.exists() && (project.findPackageFragmentRoot(resource.getFullPath()) == null)) return (IFile) resource; return null; }
private static IFile getCandidate(IAdaptable element) throws JavaModelException { IResource resource = (IResource) element.getAdapter(IResource.class); if (!(resource instanceof IFile) || !ArchiveFileFilter.isArchivePath(resource.getFullPath())) return null; IJavaProject project = JavaCore.create(resource.getProject()); if (project != null && project.exists() && (project.findPackageFragmentRoot(resource.getFullPath()) == null)) return (IFile) resource; return null; }
private static IFile getCandidate(IAdaptable element) throws JavaModelException { IResource resource= element.getAdapter(IResource.class); if (! (resource instanceof IFile) || ! ArchiveFileFilter.isArchivePath(resource.getFullPath(), true)) return null; IJavaProject project= JavaCore.create(resource.getProject()); if (project != null && project.exists() && (project.findPackageFragmentRoot(resource.getFullPath()) == null)) return (IFile) resource; return null; }
private static IFile getCandidate(IAdaptable element) throws JavaModelException { IResource resource= (IResource)element.getAdapter(IResource.class); if (! (resource instanceof IFile) || ! ArchiveFileFilter.isArchivePath(resource.getFullPath())) return null; IJavaProject project= JavaCore.create(resource.getProject()); if (project != null && project.exists() && (project.findPackageFragmentRoot(resource.getFullPath()) == null)) return (IFile) resource; return null; }
private String chooseArchive() { if (fWorkspaceRadio.isSelected()) { return chooseWorkspaceArchive(); } IPath currPath= new Path(fArchiveField.getText()); if (ArchiveFileFilter.isArchivePath(currPath, true)) { currPath= currPath.removeLastSegments(1); } FileDialog dialog= new FileDialog(fShell, SWT.OPEN | SWT.SHEET); dialog.setFilterExtensions(ArchiveFileFilter.JAR_ZIP_FILTER_EXTENSIONS); dialog.setText(PreferencesMessages.JavadocConfigurationBlock_zipImportSource_title); dialog.setFilterPath(currPath.toOSString()); return dialog.open(); }
private String chooseArchive() { if (fWorkspaceRadio.isSelected()) { return chooseWorkspaceArchive(); } IPath currPath= new Path(fArchiveField.getText()); if (ArchiveFileFilter.isArchivePath(currPath)) { currPath= currPath.removeLastSegments(1); } FileDialog dialog= new FileDialog(fShell, SWT.OPEN); dialog.setFilterExtensions(new String[] { FILE_IMPORT_MASK }); dialog.setText(PreferencesMessages.JavadocConfigurationBlock_zipImportSource_title); dialog.setFilterPath(currPath.toOSString()); return dialog.open(); }
private String chooseArchive() { if (fWorkspaceRadio.isSelected()) { return chooseWorkspaceArchive(); } IPath currPath= new Path(fArchiveField.getText()); if (ArchiveFileFilter.isArchivePath(currPath, true)) { currPath= currPath.removeLastSegments(1); } FileDialog dialog= new FileDialog(fShell, SWT.OPEN); dialog.setFilterExtensions(ArchiveFileFilter.JAR_ZIP_FILTER_EXTENSIONS); dialog.setText(PreferencesMessages.JavadocConfigurationBlock_zipImportSource_title); dialog.setFilterPath(currPath.toOSString()); return dialog.open(); }
private IPath chooseExtFolder() { IPath currPath= getFilePath(); if (currPath.segmentCount() == 0) { currPath= fEntry; } if (ArchiveFileFilter.isArchivePath(currPath, true)) { currPath= currPath.removeLastSegments(1); } DirectoryDialog dialog= new DirectoryDialog(getShell()); dialog.setMessage(NewWizardMessages.AnnotationsAttachmentBlock_extfolderdialog_message); dialog.setText(NewWizardMessages.AnnotationsAttachmentBlock_extfolderdialog_text); dialog.setFilterPath(currPath.toOSString()); String res= dialog.open(); if (res != null) { return Path.fromOSString(res).makeAbsolute(); } return null; }
private IPath chooseExtFolder() { IPath currPath= getFilePath(); if (currPath.segmentCount() == 0) { currPath= fEntry.getPath(); } if (ArchiveFileFilter.isArchivePath(currPath, true)) { currPath= currPath.removeLastSegments(1); } DirectoryDialog dialog= new DirectoryDialog(getShell()); dialog.setMessage(NewWizardMessages.SourceAttachmentBlock_extfolderdialog_message); dialog.setText(NewWizardMessages.SourceAttachmentBlock_extfolderdialog_text); dialog.setFilterPath(currPath.toOSString()); String res= dialog.open(); if (res != null) { return Path.fromOSString(res).makeAbsolute(); } return null; }
private IPath chooseExtFolder() { IPath currPath= getFilePath(); if (currPath.segmentCount() == 0) { currPath= fEntry.getPath(); } if (ArchiveFileFilter.isArchivePath(currPath)) { currPath= currPath.removeLastSegments(1); } DirectoryDialog dialog= new DirectoryDialog(getShell()); dialog.setMessage(NewWizardMessages.SourceAttachmentBlock_extfolderdialog_message); dialog.setText(NewWizardMessages.SourceAttachmentBlock_extfolderdialog_text); dialog.setFilterPath(currPath.toOSString()); String res= dialog.open(); if (res != null) { return Path.fromOSString(res).makeAbsolute(); } return null; }
private IPath chooseExtJarFile() { IPath currPath= getFilePath(); if (currPath.segmentCount() == 0) { currPath= fEntry.getPath(); } if (ArchiveFileFilter.isArchivePath(currPath)) { currPath= currPath.removeLastSegments(1); } FileDialog dialog= new FileDialog(getShell()); dialog.setText(NewWizardMessages.SourceAttachmentBlock_extjardialog_text); dialog.setFilterExtensions(new String[] {"*.jar;*.zip"}); //$NON-NLS-1$ dialog.setFilterPath(currPath.toOSString()); String res= dialog.open(); if (res != null) { return Path.fromOSString(res).makeAbsolute(); } return null; }
private IPath chooseExtJarFile() { IPath currPath= getFilePath(); if (currPath.segmentCount() == 0) { currPath= fEntry.getPath(); } if (ArchiveFileFilter.isArchivePath(currPath, true)) { currPath= currPath.removeLastSegments(1); } FileDialog dialog= new FileDialog(getShell()); dialog.setText(NewWizardMessages.SourceAttachmentBlock_extjardialog_text); dialog.setFilterExtensions(ArchiveFileFilter.JAR_ZIP_FILTER_EXTENSIONS); dialog.setFilterPath(currPath.toOSString()); String res= dialog.open(); if (res != null) { return Path.fromOSString(res).makeAbsolute(); } return null; }