private boolean categoryExists(String name) { ISiteCategoryDefinition[] defs = fModel.getSite().getCategoryDefinitions(); for (int i = 0; i < defs.length; i++) { ISiteCategoryDefinition def = defs[i]; String dname = def.getName(); if (dname != null && dname.equals(name)) return true; } return false; }
/* * (non-Javadoc) * * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#canPaste(java.lang.Object, * java.lang.Object[]) */ protected boolean canPaste(Object target, Object[] objects) { if (target == null || target instanceof ISiteCategoryDefinition) { for (int i = 0; i < objects.length; i++) { if (objects[i] instanceof SiteFeatureAdapter) return true; if (objects[i] instanceof ISiteCategoryDefinition) { String name = ((ISiteCategoryDefinition) objects[i]).getName(); ISiteCategoryDefinition[] defs = fModel.getSite().getCategoryDefinitions(); for (int j = 0; j < defs.length; j++) { ISiteCategoryDefinition def = defs[j]; String dname = def.getName(); if (dname != null && dname.equals(name)) return false; } return true; } } } return false; }