1 11 12 package org.eclipse.pde.internal.ui.editor.cheatsheet; 13 14 import java.util.HashSet ; 15 16 import org.eclipse.jface.action.Action; 17 18 22 public abstract class CSAbstractAddAction extends Action { 23 24 27 public CSAbstractAddAction() { 28 } 29 30 34 protected void addNumberToBase(StringBuffer base, HashSet set) { 35 if (set.size() > 0) { 36 int limit = 100; 38 if (set.contains(new Integer (0)) == false) { 41 } else { 43 for (int x = 1; x < limit; x++) { 44 if (set.contains(new Integer (x)) == false) { 47 base.append(" ("); base.append(x); 49 base.append(")"); break; 51 } 52 } 53 } 54 } 55 } 56 57 62 protected void compareTitleWithBase(String base, HashSet set, String title) { 63 if (title.startsWith(base)) { 65 int minSizeNumAddOn = 4; 67 if (title.length() >= (base.length() + minSizeNumAddOn)) { 70 String numPart = title.substring(base.length() + 1); 72 if (numPart.charAt(0) == '(') { 74 StringBuffer buffer = new StringBuffer (); 75 for (int j = 1; j < numPart.length(); j++) { 77 char current = numPart.charAt(j); 78 if (Character.isDigit(current)) { 80 buffer.append(current); 81 } else { 82 break; 84 } 85 } 86 if (buffer.length() > 0) { 88 set.add(new Integer (buffer.toString())); 89 } 90 } 91 92 } else { 93 set.add(new Integer (0)); 96 } 97 } 98 } 99 100 } 101 | Popular Tags |