From: incastrix Date: Wed, 7 Oct 2009 15:50:41 +0000 (+0000) Subject: Refactory: removed unused viewerFilter classes. X-Git-Url: http://git.phpeclipse.com Refactory: removed unused viewerFilter classes. --- diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/ClassFilter.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/ClassFilter.java deleted file mode 100644 index 850db3b..0000000 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/ClassFilter.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.ui.filters; - -import net.sourceforge.phpdt.core.IType; -import net.sourceforge.phpdt.core.JavaModelException; - -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -/** - * Filters classes - */ -public class ClassFilter extends ViewerFilter { - - /* - * @see ViewerFilter - */ - public boolean select(Viewer viewer, Object parent, Object element) { - if (element instanceof IType) { - try { - return ((IType) element).isInterface(); - } catch (JavaModelException ex) { - return true; - } - } - return true; - } -} diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/ClosedProjectFilter.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/ClosedProjectFilter.java deleted file mode 100644 index 2ac29b1..0000000 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/ClosedProjectFilter.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.ui.filters; - -import net.sourceforge.phpdt.core.IJavaElement; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -/** - * Filters closed projects - */ -public class ClosedProjectFilter extends ViewerFilter { - - /* - * @see ViewerFilter - */ - public boolean select(Viewer viewer, Object parent, Object element) { - if (element instanceof IJavaElement) - return ((IJavaElement) element).getJavaProject().getProject() - .isOpen(); - if (element instanceof IResource) - return ((IResource) element).getProject().isOpen(); - return true; - } -} diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/FieldsFilter.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/FieldsFilter.java deleted file mode 100644 index ad3fd39..0000000 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/FieldsFilter.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package net.sourceforge.phpdt.internal.ui.filters; - -import net.sourceforge.phpdt.internal.ui.viewsupport.MemberFilter; - -/** - * Fields filter. - * - * @since 3.0 - */ -public class FieldsFilter extends MemberFilter { - public FieldsFilter() { - addFilter(MemberFilter.FILTER_FIELDS); - } -} diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/InterfaceFilter.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/InterfaceFilter.java deleted file mode 100644 index cfe35e1..0000000 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/InterfaceFilter.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.ui.filters; - -import net.sourceforge.phpdt.core.IType; -import net.sourceforge.phpdt.core.JavaModelException; - -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -/** - * Filters interfaces - */ -public class InterfaceFilter extends ViewerFilter { - - /* - * @see ViewerFilter - */ - public boolean select(Viewer viewer, Object parent, Object element) { - if (element instanceof IType) { - try { - return !((IType) element).isInterface(); - } catch (JavaModelException ex) { - return true; - } - } - return true; - } -} diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/JavaFileFilter.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/JavaFileFilter.java deleted file mode 100644 index d406dc8..0000000 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/JavaFileFilter.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.ui.filters; - -import net.sourceforge.phpdt.core.ICompilationUnit; - -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -/** - * Filters out all compilation units and class files elements. - */ -public class JavaFileFilter extends ViewerFilter { - - /** - * Returns the result of this filter, when applied to the given inputs. - * - * @param inputs - * the set of elements to - * @return Returns true if element should be included in filtered set - */ - public boolean select(Viewer viewer, Object parent, Object element) { - if (element instanceof ICompilationUnit) - return false; - // if (element instanceof IClassFile) - // return false; - - // if (element instanceof IPackageFragment) - // try { - // return ((IPackageFragment)element).getNonJavaResources().length > 0; - // } catch (JavaModelException ex) { - // return true; - // } - return true; - } -} diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/NonJavaElementFilter.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/NonJavaElementFilter.java deleted file mode 100644 index 90c9fdf..0000000 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/NonJavaElementFilter.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.ui.filters; - -import net.sourceforge.phpdt.core.IJavaElement; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IStorage; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -/** - * Filters out all non-Java elements. - */ -public class NonJavaElementFilter extends ViewerFilter { - - /** - * Returns the result of this filter, when applied to the given inputs. - * - * @param inputs - * the set of elements to - * @return Returns true if element should be included in filtered set - */ - public boolean select(Viewer viewer, Object parent, Object element) { - if (element instanceof IJavaElement) - return true; - - if (element instanceof IResource) { - IProject project = ((IResource) element).getProject(); - return project == null || !project.isOpen(); - } - - // Exclude all IStorage elements which are neither Java elements nor - // resources - if (element instanceof IStorage) - return false; - - return true; - } -} diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/NonJavaProjectsFilter.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/NonJavaProjectsFilter.java deleted file mode 100644 index 2d3c49a..0000000 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/NonJavaProjectsFilter.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.ui.filters; - -import net.sourceforge.phpdt.core.IJavaProject; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -/** - * Filters non-java projects - */ -public class NonJavaProjectsFilter extends ViewerFilter { - - /* - * @see ViewerFilter - */ - public boolean select(Viewer viewer, Object parent, Object element) { - if (element instanceof IJavaProject) - return true; - else if (element instanceof IProject) - return !((IProject) element).isOpen(); - - return true; - } -} diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/NonPublicFilter.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/NonPublicFilter.java deleted file mode 100644 index ad9a2d3..0000000 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/NonPublicFilter.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package net.sourceforge.phpdt.internal.ui.filters; - -import net.sourceforge.phpdt.internal.ui.viewsupport.MemberFilter; - -/** - * Non-public member filter. - * - * @since 3.0 - */ -public class NonPublicFilter extends MemberFilter { - public NonPublicFilter() { - addFilter(MemberFilter.FILTER_NONPUBLIC); - } -} diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/NonPublicTypeFilter.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/NonPublicTypeFilter.java deleted file mode 100644 index 28706d9..0000000 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/NonPublicTypeFilter.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.ui.filters; - -import net.sourceforge.phpdt.core.Flags; -import net.sourceforge.phpdt.core.IType; -import net.sourceforge.phpdt.core.JavaModelException; - -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -/** - * Filters non-public types - */ -public class NonPublicTypeFilter extends ViewerFilter { - - /* - * @see ViewerFilter - */ - public boolean select(Viewer viewer, Object parent, Object element) { - if (element instanceof IType) { - IType type = (IType) element; - try { - return Flags.isPublic(type.getFlags()); - } catch (JavaModelException ex) { - return true; - } - } - return true; - } -} diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/NonSharedProjectFilter.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/NonSharedProjectFilter.java deleted file mode 100644 index f9a78e3..0000000 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/NonSharedProjectFilter.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.ui.filters; - -import net.sourceforge.phpdt.core.IJavaProject; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.team.core.RepositoryProvider; - -/** - * Filters non-shared projects and Java projects. Non-shared projects are - * projects that are not controlled by a team provider. - * - * @since 2.1 - */ -public class NonSharedProjectFilter extends ViewerFilter { - - /* - * @see ViewerFilter - */ - public boolean select(Viewer viewer, Object parent, Object element) { - if (element instanceof IProject) - return isSharedProject((IProject) element); - - if (element instanceof IJavaProject) - return isSharedProject(((IJavaProject) element).getProject()); - - return true; - } - - private boolean isSharedProject(IProject project) { - return !project.isAccessible() || RepositoryProvider.isShared(project); - } -} diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/OutputFolderFilter.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/OutputFolderFilter.java deleted file mode 100644 index 4ac7a79..0000000 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/OutputFolderFilter.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.ui.filters; - -import net.sourceforge.phpdt.core.IClasspathEntry; -import net.sourceforge.phpdt.core.IJavaProject; -import net.sourceforge.phpdt.core.JavaCore; -import net.sourceforge.phpeclipse.ui.WebUI; -//import net.sourceforge.phpeclipse.PHPeclipsePlugin; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -/** - * Filters out all output folders. - *

- * Note: Folder which are direct children of a Java element are already filtered - * by the Java Model. - *

- * - * @since 3.0 - */ -public class OutputFolderFilter extends ViewerFilter { - - /** - * Returns the result of this filter, when applied to the given element. - * - * @param element - * the element to test - * @return true if element should be included - * @since 3.0 - */ - public boolean select(Viewer viewer, Object parent, Object element) { - if (element instanceof IFolder) { - IFolder folder = (IFolder) element; - IProject proj = folder.getProject(); - try { - if (!proj.hasNature(WebUI.PHP_NATURE_ID)) - return true; - - IJavaProject jProject = JavaCore.create(folder.getProject()); - if (jProject == null || !jProject.exists()) - return true; - - // Check default output location - IPath defaultOutputLocation = jProject.getOutputLocation(); - IPath folderPath = folder.getFullPath(); - if (defaultOutputLocation != null - && defaultOutputLocation.equals(folderPath)) - return false; - - // Check output location for each class path entry - IClasspathEntry[] cpEntries = jProject.getRawClasspath(); - for (int i = 0, length = cpEntries.length; i < length; i++) { - IPath outputLocation = cpEntries[i].getOutputLocation(); - if (outputLocation != null - && outputLocation.equals(folderPath)) - return false; - } - } catch (CoreException ex) { - return true; - } - } - return true; - } -} diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/StaticsFilter.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/StaticsFilter.java deleted file mode 100644 index 6179f48..0000000 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/filters/StaticsFilter.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package net.sourceforge.phpdt.internal.ui.filters; - -import net.sourceforge.phpdt.internal.ui.viewsupport.MemberFilter; - -/** - * Statics filter. - * - * @since 3.0 - */ -public class StaticsFilter extends MemberFilter { - public StaticsFilter() { - addFilter(MemberFilter.FILTER_STATIC); - } -}