@Override public boolean exists() { return fClassFile.exists(); }
@Override public boolean exists() { return fClassFile.exists(); }
public boolean exists() { return fClassFile.exists(); }
case IPackageFragmentRoot.K_BINARY: IClassFile file = fragment.getClassFile(typeName + ".class"); //$NON-NLS-1$ if (file.exists()) { return new Object[]{file};
case IPackageFragmentRoot.K_BINARY: IClassFile file = fragment.getClassFile(typeName + ".class"); //$NON-NLS-1$ if (file.exists()) { return new Object[]{file};
if (classFile.exists()) { addAnnotations(buf, classFile.getType(), null, null);
if (cf.exists()) { return cf;
if (cf.exists()) { return cf;
private static Location fixLocation(IJavaElement element, Location location, IJavaProject javaProject) { if (!javaProject.equals(element.getJavaProject()) && element.getJavaProject().getProject().getName().equals(ProjectsManager.DEFAULT_PROJECT_NAME)) { // see issue at: https://github.com/eclipse/eclipse.jdt.ls/issues/842 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=541573 // for jdk classes, jdt will reuse the java model by altering project to share the model between projects // so that sometimes the project for `element` is default project and the project is different from the project for `unit` // this fix is to replace the project name with non-default ones since default project should be transparent to users. if (location.getUri().contains(ProjectsManager.DEFAULT_PROJECT_NAME)) { String patched = StringUtils.replaceOnce(location.getUri(), ProjectsManager.DEFAULT_PROJECT_NAME, javaProject.getProject().getName()); try { IClassFile cf = (IClassFile) JavaCore.create(JDTUtils.toURI(patched).getQuery()); if (cf != null && cf.exists()) { location.setUri(patched); } } catch (Exception ex) { } } } return location; }
if (!Util.isClassFileName(fileName) || !packageFragment.getClassFile(new String(fileName)).exists()) { return false; // classfile doesn't live in selected package
if (!Util.isClassFileName(fileName) || !packageFragment.getClassFile(new String(fileName)).exists()) { return false; // classfile doesn't live in selected package
if (!Util.isClassFileName(fileName) || !packageFragment.getClassFile(new String(fileName)).exists()) { return false; // classfile doesn't live in selected package
if (!Util.isClassFileName(fileName) || !packageFragment.getClassFile(new String(fileName)).exists()) { return false; // classfile doesn't live in selected package
if (!Util.isClassFileName(fileName) || !packageFragment.getClassFile(new String(fileName)).exists()) { return false; // classfile doesn't live in selected package
if (!Util.isClassFileName(fileName) || !packageFragment.getClassFile(new String(fileName)).exists()) { return false; // classfile doesn't live in selected package
if (file.exists()) { type = file.getType();
@Override public void update() { ITextEditor editor= getTextEditor(); boolean checked= (editor != null && editor.showsHighlightRangeOnly()); setChecked(checked); if (editor instanceof CompilationUnitEditor) { IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager(); setEnabled(manager.getWorkingCopy(editor.getEditorInput()) != null); } else if (editor instanceof ClassFileEditor) { IEditorInput input= editor.getEditorInput(); IClassFile cf= null; if (input instanceof IClassFileEditorInput) { IClassFileEditorInput cfi= (IClassFileEditorInput)input; cf= cfi.getClassFile(); } setEnabled(cf != null && cf.exists()); } else setEnabled(editor != null); }
public void update() { ITextEditor editor= getTextEditor(); boolean checked= (editor != null && editor.showsHighlightRangeOnly()); setChecked(checked); if (editor instanceof CompilationUnitEditor) { IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager(); setEnabled(manager.getWorkingCopy(editor.getEditorInput()) != null); } else if (editor instanceof ClassFileEditor) { IEditorInput input= editor.getEditorInput(); IClassFile cf= null; if (input instanceof IClassFileEditorInput) { IClassFileEditorInput cfi= (IClassFileEditorInput)input; cf= cfi.getClassFile(); } setEnabled(cf != null && cf.exists()); } else setEnabled(editor != null); }
@Override public void update() { ITextEditor editor= getTextEditor(); boolean checked= (editor != null && editor.showsHighlightRangeOnly()); setChecked(checked); if (editor instanceof CompilationUnitEditor) { IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager(); setEnabled(manager.getWorkingCopy(editor.getEditorInput()) != null); } else if (editor instanceof ClassFileEditor) { IEditorInput input= editor.getEditorInput(); IClassFile cf= null; if (input instanceof IClassFileEditorInput) { IClassFileEditorInput cfi= (IClassFileEditorInput)input; cf= cfi.getClassFile(); } setEnabled(cf != null && cf.exists()); } else setEnabled(editor != null); }