1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package org.openoffice.idesupport.filter; 25 26 public class ExceptParcelFilter implements FileFilter { 27 private static final String DESCRIPTION = "Remove specified Parcel"; 28 private static final ExceptParcelFilter filter = new ExceptParcelFilter(); 29 private static String parcelName = null; 30 ExceptParcelFilter()31 private ExceptParcelFilter() { 32 } 33 setParcelToRemove(String parcelName)34 public void setParcelToRemove(String parcelName) 35 { 36 this.parcelName = parcelName; 37 } 38 getInstance()39 public static ExceptParcelFilter getInstance() { 40 return filter; 41 } validate(String name)42 public boolean validate(String name) { 43 if (name.startsWith(this.parcelName)) 44 return true; 45 return false; 46 } 47 toString()48 public String toString() { 49 StringBuffer buf = new StringBuffer(DESCRIPTION + ": "); 50 51 buf.append("<" + this.parcelName + ">"); 52 53 return buf.toString(); 54 } 55 } 56